Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
space4icity
application
Compare Revisions
12535794e40e861a28896071b7df02adebb2e0e3...155e1be16677f341ce9b54bb1ae02a28f41b6d07
Hide whitespace changes
Inline
Side-by-side
Too many changes to show.
To preserve performance only
20 of 320+
files are displayed.
public/assets/cesium/Workers/createCoplanarPolygonGeometry.js
0 → 100644
View file @
155e1be1
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import
{
BoundingRectangle_default
}
from
"
./chunk-44QAAS4P.js
"
;
import
{
CoplanarPolygonGeometryLibrary_default
}
from
"
./chunk-TK5IIG2F.js
"
;
import
"
./chunk-2PTKXHJB.js
"
;
import
{
PolygonGeometryLibrary_default
}
from
"
./chunk-IZJ42N4W.js
"
;
import
"
./chunk-XWOUPGUF.js
"
;
import
{
GeometryInstance_default
}
from
"
./chunk-YSIJTJ7N.js
"
;
import
{
GeometryPipeline_default
}
from
"
./chunk-7ZZ5LMZY.js
"
;
import
"
./chunk-LJ2JQHJT.js
"
;
import
"
./chunk-NGZJIN5Z.js
"
;
import
{
VertexFormat_default
}
from
"
./chunk-JBSKHTNX.js
"
;
import
"
./chunk-YK3QIKY7.js
"
;
import
"
./chunk-NDDI2LWR.js
"
;
import
{
PolygonPipeline_default
}
from
"
./chunk-TI3TRKIC.js
"
;
import
{
arrayRemoveDuplicates_default
}
from
"
./chunk-57H6I3SV.js
"
;
import
"
./chunk-JSQJDZI4.js
"
;
import
"
./chunk-QQOZO7KO.js
"
;
import
"
./chunk-EDLRS3AW.js
"
;
import
{
IndexDatatype_default
}
from
"
./chunk-C4WPMOKT.js
"
;
import
{
GeometryAttributes_default
}
from
"
./chunk-X7IQYYHF.js
"
;
import
{
GeometryAttribute_default
,
Geometry_default
,
PrimitiveType_default
}
from
"
./chunk-JXVLNVXC.js
"
;
import
{
BoundingSphere_default
}
from
"
./chunk-KHZNBFOH.js
"
;
import
{
Quaternion_default
}
from
"
./chunk-6SQMLVGV.js
"
;
import
{
ComponentDatatype_default
}
from
"
./chunk-XIUSRWL6.js
"
;
import
{
Cartesian2_default
,
Cartesian3_default
,
Ellipsoid_default
,
Matrix3_default
}
from
"
./chunk-FFLMY4TE.js
"
;
import
{
Math_default
}
from
"
./chunk-WGDFYAGC.js
"
;
import
"
./chunk-3HQMMUPU.js
"
;
import
"
./chunk-LLAF3CPH.js
"
;
import
{
defaultValue_default
}
from
"
./chunk-U5HSOKPQ.js
"
;
import
{
Check_default
}
from
"
./chunk-P6TRGU3S.js
"
;
import
{
defined_default
}
from
"
./chunk-YCDZX5LS.js
"
;
// packages/engine/Source/Core/CoplanarPolygonGeometry.js
var
scratchPosition
=
new
Cartesian3_default
();
var
scratchBR
=
new
BoundingRectangle_default
();
var
stScratch
=
new
Cartesian2_default
();
var
textureCoordinatesOrigin
=
new
Cartesian2_default
();
var
scratchNormal
=
new
Cartesian3_default
();
var
scratchTangent
=
new
Cartesian3_default
();
var
scratchBitangent
=
new
Cartesian3_default
();
var
centerScratch
=
new
Cartesian3_default
();
var
axis1Scratch
=
new
Cartesian3_default
();
var
axis2Scratch
=
new
Cartesian3_default
();
var
quaternionScratch
=
new
Quaternion_default
();
var
textureMatrixScratch
=
new
Matrix3_default
();
var
tangentRotationScratch
=
new
Matrix3_default
();
var
surfaceNormalScratch
=
new
Cartesian3_default
();
function
createGeometryFromPolygon
(
polygon
,
vertexFormat
,
boundingRectangle
,
stRotation
,
hardcodedTextureCoordinates
,
projectPointTo2D
,
normal
,
tangent
,
bitangent
)
{
const
positions
=
polygon
.
positions
;
let
indices
=
PolygonPipeline_default
.
triangulate
(
polygon
.
positions2D
,
polygon
.
holes
);
if
(
indices
.
length
<
3
)
{
indices
=
[
0
,
1
,
2
];
}
const
newIndices
=
IndexDatatype_default
.
createTypedArray
(
positions
.
length
,
indices
.
length
);
newIndices
.
set
(
indices
);
let
textureMatrix
=
textureMatrixScratch
;
if
(
stRotation
!==
0
)
{
let
rotation
=
Quaternion_default
.
fromAxisAngle
(
normal
,
stRotation
,
quaternionScratch
);
textureMatrix
=
Matrix3_default
.
fromQuaternion
(
rotation
,
textureMatrix
);
if
(
vertexFormat
.
tangent
||
vertexFormat
.
bitangent
)
{
rotation
=
Quaternion_default
.
fromAxisAngle
(
normal
,
-
stRotation
,
quaternionScratch
);
const
tangentRotation
=
Matrix3_default
.
fromQuaternion
(
rotation
,
tangentRotationScratch
);
tangent
=
Cartesian3_default
.
normalize
(
Matrix3_default
.
multiplyByVector
(
tangentRotation
,
tangent
,
tangent
),
tangent
);
if
(
vertexFormat
.
bitangent
)
{
bitangent
=
Cartesian3_default
.
normalize
(
Cartesian3_default
.
cross
(
normal
,
tangent
,
bitangent
),
bitangent
);
}
}
}
else
{
textureMatrix
=
Matrix3_default
.
clone
(
Matrix3_default
.
IDENTITY
,
textureMatrix
);
}
const
stOrigin
=
textureCoordinatesOrigin
;
if
(
vertexFormat
.
st
)
{
stOrigin
.
x
=
boundingRectangle
.
x
;
stOrigin
.
y
=
boundingRectangle
.
y
;
}
const
length
=
positions
.
length
;
const
size
=
length
*
3
;
const
flatPositions
=
new
Float64Array
(
size
);
const
normals
=
vertexFormat
.
normal
?
new
Float32Array
(
size
)
:
void
0
;
const
tangents
=
vertexFormat
.
tangent
?
new
Float32Array
(
size
)
:
void
0
;
const
bitangents
=
vertexFormat
.
bitangent
?
new
Float32Array
(
size
)
:
void
0
;
const
textureCoordinates
=
vertexFormat
.
st
?
new
Float32Array
(
length
*
2
)
:
void
0
;
let
positionIndex
=
0
;
let
normalIndex
=
0
;
let
bitangentIndex
=
0
;
let
tangentIndex
=
0
;
let
stIndex
=
0
;
for
(
let
i
=
0
;
i
<
length
;
i
++
)
{
const
position
=
positions
[
i
];
flatPositions
[
positionIndex
++
]
=
position
.
x
;
flatPositions
[
positionIndex
++
]
=
position
.
y
;
flatPositions
[
positionIndex
++
]
=
position
.
z
;
if
(
vertexFormat
.
st
)
{
if
(
defined_default
(
hardcodedTextureCoordinates
)
&&
hardcodedTextureCoordinates
.
positions
.
length
===
length
)
{
textureCoordinates
[
stIndex
++
]
=
hardcodedTextureCoordinates
.
positions
[
i
].
x
;
textureCoordinates
[
stIndex
++
]
=
hardcodedTextureCoordinates
.
positions
[
i
].
y
;
}
else
{
const
p
=
Matrix3_default
.
multiplyByVector
(
textureMatrix
,
position
,
scratchPosition
);
const
st
=
projectPointTo2D
(
p
,
stScratch
);
Cartesian2_default
.
subtract
(
st
,
stOrigin
,
st
);
const
stx
=
Math_default
.
clamp
(
st
.
x
/
boundingRectangle
.
width
,
0
,
1
);
const
sty
=
Math_default
.
clamp
(
st
.
y
/
boundingRectangle
.
height
,
0
,
1
);
textureCoordinates
[
stIndex
++
]
=
stx
;
textureCoordinates
[
stIndex
++
]
=
sty
;
}
}
if
(
vertexFormat
.
normal
)
{
normals
[
normalIndex
++
]
=
normal
.
x
;
normals
[
normalIndex
++
]
=
normal
.
y
;
normals
[
normalIndex
++
]
=
normal
.
z
;
}
if
(
vertexFormat
.
tangent
)
{
tangents
[
tangentIndex
++
]
=
tangent
.
x
;
tangents
[
tangentIndex
++
]
=
tangent
.
y
;
tangents
[
tangentIndex
++
]
=
tangent
.
z
;
}
if
(
vertexFormat
.
bitangent
)
{
bitangents
[
bitangentIndex
++
]
=
bitangent
.
x
;
bitangents
[
bitangentIndex
++
]
=
bitangent
.
y
;
bitangents
[
bitangentIndex
++
]
=
bitangent
.
z
;
}
}
const
attributes
=
new
GeometryAttributes_default
();
if
(
vertexFormat
.
position
)
{
attributes
.
position
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
DOUBLE
,
componentsPerAttribute
:
3
,
values
:
flatPositions
});
}
if
(
vertexFormat
.
normal
)
{
attributes
.
normal
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
FLOAT
,
componentsPerAttribute
:
3
,
values
:
normals
});
}
if
(
vertexFormat
.
tangent
)
{
attributes
.
tangent
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
FLOAT
,
componentsPerAttribute
:
3
,
values
:
tangents
});
}
if
(
vertexFormat
.
bitangent
)
{
attributes
.
bitangent
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
FLOAT
,
componentsPerAttribute
:
3
,
values
:
bitangents
});
}
if
(
vertexFormat
.
st
)
{
attributes
.
st
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
FLOAT
,
componentsPerAttribute
:
2
,
values
:
textureCoordinates
});
}
return
new
Geometry_default
({
attributes
,
indices
:
newIndices
,
primitiveType
:
PrimitiveType_default
.
TRIANGLES
});
}
function
CoplanarPolygonGeometry
(
options
)
{
options
=
defaultValue_default
(
options
,
defaultValue_default
.
EMPTY_OBJECT
);
const
polygonHierarchy
=
options
.
polygonHierarchy
;
const
textureCoordinates
=
options
.
textureCoordinates
;
Check_default
.
defined
(
"
options.polygonHierarchy
"
,
polygonHierarchy
);
const
vertexFormat
=
defaultValue_default
(
options
.
vertexFormat
,
VertexFormat_default
.
DEFAULT
);
this
.
_vertexFormat
=
VertexFormat_default
.
clone
(
vertexFormat
);
this
.
_polygonHierarchy
=
polygonHierarchy
;
this
.
_stRotation
=
defaultValue_default
(
options
.
stRotation
,
0
);
this
.
_ellipsoid
=
Ellipsoid_default
.
clone
(
defaultValue_default
(
options
.
ellipsoid
,
Ellipsoid_default
.
default
)
);
this
.
_workerName
=
"
createCoplanarPolygonGeometry
"
;
this
.
_textureCoordinates
=
textureCoordinates
;
this
.
packedLength
=
PolygonGeometryLibrary_default
.
computeHierarchyPackedLength
(
polygonHierarchy
,
Cartesian3_default
)
+
VertexFormat_default
.
packedLength
+
Ellipsoid_default
.
packedLength
+
(
defined_default
(
textureCoordinates
)
?
PolygonGeometryLibrary_default
.
computeHierarchyPackedLength
(
textureCoordinates
,
Cartesian2_default
)
:
1
)
+
2
;
}
CoplanarPolygonGeometry
.
fromPositions
=
function
(
options
)
{
options
=
defaultValue_default
(
options
,
defaultValue_default
.
EMPTY_OBJECT
);
Check_default
.
defined
(
"
options.positions
"
,
options
.
positions
);
const
newOptions
=
{
polygonHierarchy
:
{
positions
:
options
.
positions
},
vertexFormat
:
options
.
vertexFormat
,
stRotation
:
options
.
stRotation
,
ellipsoid
:
options
.
ellipsoid
,
textureCoordinates
:
options
.
textureCoordinates
};
return
new
CoplanarPolygonGeometry
(
newOptions
);
};
CoplanarPolygonGeometry
.
pack
=
function
(
value
,
array
,
startingIndex
)
{
Check_default
.
typeOf
.
object
(
"
value
"
,
value
);
Check_default
.
defined
(
"
array
"
,
array
);
startingIndex
=
defaultValue_default
(
startingIndex
,
0
);
startingIndex
=
PolygonGeometryLibrary_default
.
packPolygonHierarchy
(
value
.
_polygonHierarchy
,
array
,
startingIndex
,
Cartesian3_default
);
Ellipsoid_default
.
pack
(
value
.
_ellipsoid
,
array
,
startingIndex
);
startingIndex
+=
Ellipsoid_default
.
packedLength
;
VertexFormat_default
.
pack
(
value
.
_vertexFormat
,
array
,
startingIndex
);
startingIndex
+=
VertexFormat_default
.
packedLength
;
array
[
startingIndex
++
]
=
value
.
_stRotation
;
if
(
defined_default
(
value
.
_textureCoordinates
))
{
startingIndex
=
PolygonGeometryLibrary_default
.
packPolygonHierarchy
(
value
.
_textureCoordinates
,
array
,
startingIndex
,
Cartesian2_default
);
}
else
{
array
[
startingIndex
++
]
=
-
1
;
}
array
[
startingIndex
++
]
=
value
.
packedLength
;
return
array
;
};
var
scratchEllipsoid
=
Ellipsoid_default
.
clone
(
Ellipsoid_default
.
UNIT_SPHERE
);
var
scratchVertexFormat
=
new
VertexFormat_default
();
var
scratchOptions
=
{
polygonHierarchy
:
{}
};
CoplanarPolygonGeometry
.
unpack
=
function
(
array
,
startingIndex
,
result
)
{
Check_default
.
defined
(
"
array
"
,
array
);
startingIndex
=
defaultValue_default
(
startingIndex
,
0
);
const
polygonHierarchy
=
PolygonGeometryLibrary_default
.
unpackPolygonHierarchy
(
array
,
startingIndex
,
Cartesian3_default
);
startingIndex
=
polygonHierarchy
.
startingIndex
;
delete
polygonHierarchy
.
startingIndex
;
const
ellipsoid
=
Ellipsoid_default
.
unpack
(
array
,
startingIndex
,
scratchEllipsoid
);
startingIndex
+=
Ellipsoid_default
.
packedLength
;
const
vertexFormat
=
VertexFormat_default
.
unpack
(
array
,
startingIndex
,
scratchVertexFormat
);
startingIndex
+=
VertexFormat_default
.
packedLength
;
const
stRotation
=
array
[
startingIndex
++
];
const
textureCoordinates
=
array
[
startingIndex
]
===
-
1
?
void
0
:
PolygonGeometryLibrary_default
.
unpackPolygonHierarchy
(
array
,
startingIndex
,
Cartesian2_default
);
if
(
defined_default
(
textureCoordinates
))
{
startingIndex
=
textureCoordinates
.
startingIndex
;
delete
textureCoordinates
.
startingIndex
;
}
else
{
startingIndex
++
;
}
const
packedLength
=
array
[
startingIndex
++
];
if
(
!
defined_default
(
result
))
{
result
=
new
CoplanarPolygonGeometry
(
scratchOptions
);
}
result
.
_polygonHierarchy
=
polygonHierarchy
;
result
.
_ellipsoid
=
Ellipsoid_default
.
clone
(
ellipsoid
,
result
.
_ellipsoid
);
result
.
_vertexFormat
=
VertexFormat_default
.
clone
(
vertexFormat
,
result
.
_vertexFormat
);
result
.
_stRotation
=
stRotation
;
result
.
_textureCoordinates
=
textureCoordinates
;
result
.
packedLength
=
packedLength
;
return
result
;
};
CoplanarPolygonGeometry
.
createGeometry
=
function
(
polygonGeometry
)
{
const
vertexFormat
=
polygonGeometry
.
_vertexFormat
;
const
polygonHierarchy
=
polygonGeometry
.
_polygonHierarchy
;
const
stRotation
=
polygonGeometry
.
_stRotation
;
const
textureCoordinates
=
polygonGeometry
.
_textureCoordinates
;
const
hasTextureCoordinates
=
defined_default
(
textureCoordinates
);
let
outerPositions
=
polygonHierarchy
.
positions
;
outerPositions
=
arrayRemoveDuplicates_default
(
outerPositions
,
Cartesian3_default
.
equalsEpsilon
,
true
);
if
(
outerPositions
.
length
<
3
)
{
return
;
}
let
normal
=
scratchNormal
;
let
tangent
=
scratchTangent
;
let
bitangent
=
scratchBitangent
;
let
axis1
=
axis1Scratch
;
const
axis2
=
axis2Scratch
;
const
validGeometry
=
CoplanarPolygonGeometryLibrary_default
.
computeProjectTo2DArguments
(
outerPositions
,
centerScratch
,
axis1
,
axis2
);
if
(
!
validGeometry
)
{
return
void
0
;
}
normal
=
Cartesian3_default
.
cross
(
axis1
,
axis2
,
normal
);
normal
=
Cartesian3_default
.
normalize
(
normal
,
normal
);
if
(
!
Cartesian3_default
.
equalsEpsilon
(
centerScratch
,
Cartesian3_default
.
ZERO
,
Math_default
.
EPSILON6
))
{
const
surfaceNormal
=
polygonGeometry
.
_ellipsoid
.
geodeticSurfaceNormal
(
centerScratch
,
surfaceNormalScratch
);
if
(
Cartesian3_default
.
dot
(
normal
,
surfaceNormal
)
<
0
)
{
normal
=
Cartesian3_default
.
negate
(
normal
,
normal
);
axis1
=
Cartesian3_default
.
negate
(
axis1
,
axis1
);
}
}
const
projectPoints
=
CoplanarPolygonGeometryLibrary_default
.
createProjectPointsTo2DFunction
(
centerScratch
,
axis1
,
axis2
);
const
projectPoint
=
CoplanarPolygonGeometryLibrary_default
.
createProjectPointTo2DFunction
(
centerScratch
,
axis1
,
axis2
);
if
(
vertexFormat
.
tangent
)
{
tangent
=
Cartesian3_default
.
clone
(
axis1
,
tangent
);
}
if
(
vertexFormat
.
bitangent
)
{
bitangent
=
Cartesian3_default
.
clone
(
axis2
,
bitangent
);
}
const
results
=
PolygonGeometryLibrary_default
.
polygonsFromHierarchy
(
polygonHierarchy
,
hasTextureCoordinates
,
projectPoints
,
false
);
const
hierarchy
=
results
.
hierarchy
;
const
polygons
=
results
.
polygons
;
const
dummyFunction
=
function
(
identity
)
{
return
identity
;
};
const
textureCoordinatePolygons
=
hasTextureCoordinates
?
PolygonGeometryLibrary_default
.
polygonsFromHierarchy
(
textureCoordinates
,
true
,
dummyFunction
,
false
).
polygons
:
void
0
;
if
(
hierarchy
.
length
===
0
)
{
return
;
}
outerPositions
=
hierarchy
[
0
].
outerRing
;
const
boundingSphere
=
BoundingSphere_default
.
fromPoints
(
outerPositions
);
const
boundingRectangle
=
PolygonGeometryLibrary_default
.
computeBoundingRectangle
(
normal
,
projectPoint
,
outerPositions
,
stRotation
,
scratchBR
);
const
geometries
=
[];
for
(
let
i
=
0
;
i
<
polygons
.
length
;
i
++
)
{
const
geometryInstance
=
new
GeometryInstance_default
({
geometry
:
createGeometryFromPolygon
(
polygons
[
i
],
vertexFormat
,
boundingRectangle
,
stRotation
,
hasTextureCoordinates
?
textureCoordinatePolygons
[
i
]
:
void
0
,
projectPoint
,
normal
,
tangent
,
bitangent
)
});
geometries
.
push
(
geometryInstance
);
}
const
geometry
=
GeometryPipeline_default
.
combineInstances
(
geometries
)[
0
];
geometry
.
attributes
.
position
.
values
=
new
Float64Array
(
geometry
.
attributes
.
position
.
values
);
geometry
.
indices
=
IndexDatatype_default
.
createTypedArray
(
geometry
.
attributes
.
position
.
values
.
length
/
3
,
geometry
.
indices
);
const
attributes
=
geometry
.
attributes
;
if
(
!
vertexFormat
.
position
)
{
delete
attributes
.
position
;
}
return
new
Geometry_default
({
attributes
,
indices
:
geometry
.
indices
,
primitiveType
:
geometry
.
primitiveType
,
boundingSphere
});
};
var
CoplanarPolygonGeometry_default
=
CoplanarPolygonGeometry
;
// packages/engine/Source/Workers/createCoplanarPolygonGeometry.js
function
createCoplanarPolygonGeometry
(
polygonGeometry
,
offset
)
{
if
(
defined_default
(
offset
))
{
polygonGeometry
=
CoplanarPolygonGeometry_default
.
unpack
(
polygonGeometry
,
offset
);
}
return
CoplanarPolygonGeometry_default
.
createGeometry
(
polygonGeometry
);
}
var
createCoplanarPolygonGeometry_default
=
createCoplanarPolygonGeometry
;
export
{
createCoplanarPolygonGeometry_default
as
default
};
public/assets/cesium/Workers/createCoplanarPolygonOutlineGeometry.js
0 → 100644
View file @
155e1be1
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import
{
CoplanarPolygonGeometryLibrary_default
}
from
"
./chunk-TK5IIG2F.js
"
;
import
"
./chunk-2PTKXHJB.js
"
;
import
{
PolygonGeometryLibrary_default
}
from
"
./chunk-IZJ42N4W.js
"
;
import
"
./chunk-XWOUPGUF.js
"
;
import
{
GeometryInstance_default
}
from
"
./chunk-YSIJTJ7N.js
"
;
import
{
GeometryPipeline_default
}
from
"
./chunk-7ZZ5LMZY.js
"
;
import
"
./chunk-LJ2JQHJT.js
"
;
import
"
./chunk-NGZJIN5Z.js
"
;
import
"
./chunk-YK3QIKY7.js
"
;
import
"
./chunk-NDDI2LWR.js
"
;
import
"
./chunk-TI3TRKIC.js
"
;
import
{
arrayRemoveDuplicates_default
}
from
"
./chunk-57H6I3SV.js
"
;
import
"
./chunk-JSQJDZI4.js
"
;
import
"
./chunk-QQOZO7KO.js
"
;
import
"
./chunk-EDLRS3AW.js
"
;
import
{
IndexDatatype_default
}
from
"
./chunk-C4WPMOKT.js
"
;
import
{
GeometryAttributes_default
}
from
"
./chunk-X7IQYYHF.js
"
;
import
{
GeometryAttribute_default
,
Geometry_default
,
PrimitiveType_default
}
from
"
./chunk-JXVLNVXC.js
"
;
import
{
BoundingSphere_default
}
from
"
./chunk-KHZNBFOH.js
"
;
import
"
./chunk-6SQMLVGV.js
"
;
import
{
ComponentDatatype_default
}
from
"
./chunk-XIUSRWL6.js
"
;
import
{
Cartesian3_default
,
Ellipsoid_default
}
from
"
./chunk-FFLMY4TE.js
"
;
import
"
./chunk-WGDFYAGC.js
"
;
import
"
./chunk-3HQMMUPU.js
"
;
import
"
./chunk-LLAF3CPH.js
"
;
import
{
defaultValue_default
}
from
"
./chunk-U5HSOKPQ.js
"
;
import
{
Check_default
}
from
"
./chunk-P6TRGU3S.js
"
;
import
{
defined_default
}
from
"
./chunk-YCDZX5LS.js
"
;
// packages/engine/Source/Core/CoplanarPolygonOutlineGeometry.js
function
createGeometryFromPositions
(
positions
)
{
const
length
=
positions
.
length
;
const
flatPositions
=
new
Float64Array
(
length
*
3
);
const
indices
=
IndexDatatype_default
.
createTypedArray
(
length
,
length
*
2
);
let
positionIndex
=
0
;
let
index
=
0
;
for
(
let
i
=
0
;
i
<
length
;
i
++
)
{
const
position
=
positions
[
i
];
flatPositions
[
positionIndex
++
]
=
position
.
x
;
flatPositions
[
positionIndex
++
]
=
position
.
y
;
flatPositions
[
positionIndex
++
]
=
position
.
z
;
indices
[
index
++
]
=
i
;
indices
[
index
++
]
=
(
i
+
1
)
%
length
;
}
const
attributes
=
new
GeometryAttributes_default
({
position
:
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
DOUBLE
,
componentsPerAttribute
:
3
,
values
:
flatPositions
})
});
return
new
Geometry_default
({
attributes
,
indices
,
primitiveType
:
PrimitiveType_default
.
LINES
});
}
function
CoplanarPolygonOutlineGeometry
(
options
)
{
options
=
defaultValue_default
(
options
,
defaultValue_default
.
EMPTY_OBJECT
);
const
polygonHierarchy
=
options
.
polygonHierarchy
;
Check_default
.
defined
(
"
options.polygonHierarchy
"
,
polygonHierarchy
);
this
.
_polygonHierarchy
=
polygonHierarchy
;
this
.
_workerName
=
"
createCoplanarPolygonOutlineGeometry
"
;
this
.
packedLength
=
PolygonGeometryLibrary_default
.
computeHierarchyPackedLength
(
polygonHierarchy
,
Cartesian3_default
)
+
1
;
}
CoplanarPolygonOutlineGeometry
.
fromPositions
=
function
(
options
)
{
options
=
defaultValue_default
(
options
,
defaultValue_default
.
EMPTY_OBJECT
);
Check_default
.
defined
(
"
options.positions
"
,
options
.
positions
);
const
newOptions
=
{
polygonHierarchy
:
{
positions
:
options
.
positions
}
};
return
new
CoplanarPolygonOutlineGeometry
(
newOptions
);
};
CoplanarPolygonOutlineGeometry
.
pack
=
function
(
value
,
array
,
startingIndex
)
{
Check_default
.
typeOf
.
object
(
"
value
"
,
value
);
Check_default
.
defined
(
"
array
"
,
array
);
startingIndex
=
defaultValue_default
(
startingIndex
,
0
);
startingIndex
=
PolygonGeometryLibrary_default
.
packPolygonHierarchy
(
value
.
_polygonHierarchy
,
array
,
startingIndex
,
Cartesian3_default
);
array
[
startingIndex
]
=
value
.
packedLength
;
return
array
;
};
var
scratchOptions
=
{
polygonHierarchy
:
{}
};
CoplanarPolygonOutlineGeometry
.
unpack
=
function
(
array
,
startingIndex
,
result
)
{
Check_default
.
defined
(
"
array
"
,
array
);
startingIndex
=
defaultValue_default
(
startingIndex
,
0
);
const
polygonHierarchy
=
PolygonGeometryLibrary_default
.
unpackPolygonHierarchy
(
array
,
startingIndex
,
Cartesian3_default
);
startingIndex
=
polygonHierarchy
.
startingIndex
;
delete
polygonHierarchy
.
startingIndex
;
const
packedLength
=
array
[
startingIndex
];
if
(
!
defined_default
(
result
))
{
result
=
new
CoplanarPolygonOutlineGeometry
(
scratchOptions
);
}
result
.
_polygonHierarchy
=
polygonHierarchy
;
result
.
packedLength
=
packedLength
;
return
result
;
};
CoplanarPolygonOutlineGeometry
.
createGeometry
=
function
(
polygonGeometry
)
{
const
polygonHierarchy
=
polygonGeometry
.
_polygonHierarchy
;
let
outerPositions
=
polygonHierarchy
.
positions
;
outerPositions
=
arrayRemoveDuplicates_default
(
outerPositions
,
Cartesian3_default
.
equalsEpsilon
,
true
);
if
(
outerPositions
.
length
<
3
)
{
return
;
}
const
isValid
=
CoplanarPolygonGeometryLibrary_default
.
validOutline
(
outerPositions
);
if
(
!
isValid
)
{
return
void
0
;
}
const
polygons
=
PolygonGeometryLibrary_default
.
polygonOutlinesFromHierarchy
(
polygonHierarchy
,
false
);
if
(
polygons
.
length
===
0
)
{
return
void
0
;
}
const
geometries
=
[];
for
(
let
i
=
0
;
i
<
polygons
.
length
;
i
++
)
{
const
geometryInstance
=
new
GeometryInstance_default
({
geometry
:
createGeometryFromPositions
(
polygons
[
i
])
});
geometries
.
push
(
geometryInstance
);
}
const
geometry
=
GeometryPipeline_default
.
combineInstances
(
geometries
)[
0
];
const
boundingSphere
=
BoundingSphere_default
.
fromPoints
(
polygonHierarchy
.
positions
);
return
new
Geometry_default
({
attributes
:
geometry
.
attributes
,
indices
:
geometry
.
indices
,
primitiveType
:
geometry
.
primitiveType
,
boundingSphere
});
};
var
CoplanarPolygonOutlineGeometry_default
=
CoplanarPolygonOutlineGeometry
;
// packages/engine/Source/Workers/createCoplanarPolygonOutlineGeometry.js
function
createCoplanarPolygonOutlineGeometry
(
polygonGeometry
,
offset
)
{
if
(
defined_default
(
offset
))
{
polygonGeometry
=
CoplanarPolygonOutlineGeometry_default
.
unpack
(
polygonGeometry
,
offset
);
}
polygonGeometry
.
_ellipsoid
=
Ellipsoid_default
.
clone
(
polygonGeometry
.
_ellipsoid
);
return
CoplanarPolygonOutlineGeometry_default
.
createGeometry
(
polygonGeometry
);
}
var
createCoplanarPolygonOutlineGeometry_default
=
createCoplanarPolygonOutlineGeometry
;
export
{
createCoplanarPolygonOutlineGeometry_default
as
default
};
public/assets/cesium/Workers/createCorridorGeometry.js
0 → 100644
View file @
155e1be1
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import
{
CorridorGeometryLibrary_default
}
from
"
./chunk-EJVGYGLF.js
"
;
import
{
CornerType_default
}
from
"
./chunk-3IFRSGEY.js
"
;
import
"
./chunk-QN6TBED4.js
"
;
import
"
./chunk-C3EQ27WF.js
"
;
import
{
GeometryOffsetAttribute_default
}
from
"
./chunk-GBT7MJ6X.js
"
;
import
{
VertexFormat_default
}
from
"
./chunk-JBSKHTNX.js
"
;
import
"
./chunk-YK3QIKY7.js
"
;
import
"
./chunk-NDDI2LWR.js
"
;
import
{
PolygonPipeline_default
}
from
"
./chunk-TI3TRKIC.js
"
;
import
{
arrayRemoveDuplicates_default
}
from
"
./chunk-57H6I3SV.js
"
;
import
"
./chunk-JSQJDZI4.js
"
;
import
"
./chunk-QQOZO7KO.js
"
;
import
"
./chunk-EDLRS3AW.js
"
;
import
{
IndexDatatype_default
}
from
"
./chunk-C4WPMOKT.js
"
;
import
{
GeometryAttributes_default
}
from
"
./chunk-X7IQYYHF.js
"
;
import
{
GeometryAttribute_default
,
Geometry_default
,
PrimitiveType_default
}
from
"
./chunk-JXVLNVXC.js
"
;
import
{
BoundingSphere_default
}
from
"
./chunk-KHZNBFOH.js
"
;
import
{
Rectangle_default
}
from
"
./chunk-6SQMLVGV.js
"
;
import
{
ComponentDatatype_default
}
from
"
./chunk-XIUSRWL6.js
"
;
import
{
Cartesian3_default
,
Cartographic_default
,
Ellipsoid_default
}
from
"
./chunk-FFLMY4TE.js
"
;
import
{
Math_default
}
from
"
./chunk-WGDFYAGC.js
"
;
import
"
./chunk-3HQMMUPU.js
"
;
import
"
./chunk-LLAF3CPH.js
"
;
import
{
defaultValue_default
}
from
"
./chunk-U5HSOKPQ.js
"
;
import
{
Check_default
}
from
"
./chunk-P6TRGU3S.js
"
;
import
{
defined_default
}
from
"
./chunk-YCDZX5LS.js
"
;
// packages/engine/Source/Core/CorridorGeometry.js
var
cartesian1
=
new
Cartesian3_default
();
var
cartesian2
=
new
Cartesian3_default
();
var
cartesian3
=
new
Cartesian3_default
();
var
cartesian4
=
new
Cartesian3_default
();
var
cartesian5
=
new
Cartesian3_default
();
var
cartesian6
=
new
Cartesian3_default
();
var
scratch1
=
new
Cartesian3_default
();
var
scratch2
=
new
Cartesian3_default
();
function
scaleToSurface
(
positions
,
ellipsoid
)
{
for
(
let
i
=
0
;
i
<
positions
.
length
;
i
++
)
{
positions
[
i
]
=
ellipsoid
.
scaleToGeodeticSurface
(
positions
[
i
],
positions
[
i
]);
}
return
positions
;
}
function
addNormals
(
attr
,
normal
,
left
,
front
,
back
,
vertexFormat
)
{
const
normals
=
attr
.
normals
;
const
tangents
=
attr
.
tangents
;
const
bitangents
=
attr
.
bitangents
;
const
forward
=
Cartesian3_default
.
normalize
(
Cartesian3_default
.
cross
(
left
,
normal
,
scratch1
),
scratch1
);
if
(
vertexFormat
.
normal
)
{
CorridorGeometryLibrary_default
.
addAttribute
(
normals
,
normal
,
front
,
back
);
}
if
(
vertexFormat
.
tangent
)
{
CorridorGeometryLibrary_default
.
addAttribute
(
tangents
,
forward
,
front
,
back
);
}
if
(
vertexFormat
.
bitangent
)
{
CorridorGeometryLibrary_default
.
addAttribute
(
bitangents
,
left
,
front
,
back
);
}
}
function
combine
(
computedPositions
,
vertexFormat
,
ellipsoid
)
{
const
positions
=
computedPositions
.
positions
;
const
corners
=
computedPositions
.
corners
;
const
endPositions
=
computedPositions
.
endPositions
;
const
computedLefts
=
computedPositions
.
lefts
;
const
computedNormals
=
computedPositions
.
normals
;
const
attributes
=
new
GeometryAttributes_default
();
let
corner
;
let
leftCount
=
0
;
let
rightCount
=
0
;
let
i
;
let
indicesLength
=
0
;
let
length
;
for
(
i
=
0
;
i
<
positions
.
length
;
i
+=
2
)
{
length
=
positions
[
i
].
length
-
3
;
leftCount
+=
length
;
indicesLength
+=
length
*
2
;
rightCount
+=
positions
[
i
+
1
].
length
-
3
;
}
leftCount
+=
3
;
rightCount
+=
3
;
for
(
i
=
0
;
i
<
corners
.
length
;
i
++
)
{
corner
=
corners
[
i
];
const
leftSide
=
corners
[
i
].
leftPositions
;
if
(
defined_default
(
leftSide
))
{
length
=
leftSide
.
length
;
leftCount
+=
length
;
indicesLength
+=
length
;
}
else
{
length
=
corners
[
i
].
rightPositions
.
length
;
rightCount
+=
length
;
indicesLength
+=
length
;
}
}
const
addEndPositions
=
defined_default
(
endPositions
);
let
endPositionLength
;
if
(
addEndPositions
)
{
endPositionLength
=
endPositions
[
0
].
length
-
3
;
leftCount
+=
endPositionLength
;
rightCount
+=
endPositionLength
;
endPositionLength
/=
3
;
indicesLength
+=
endPositionLength
*
6
;
}
const
size
=
leftCount
+
rightCount
;
const
finalPositions
=
new
Float64Array
(
size
);
const
normals
=
vertexFormat
.
normal
?
new
Float32Array
(
size
)
:
void
0
;
const
tangents
=
vertexFormat
.
tangent
?
new
Float32Array
(
size
)
:
void
0
;
const
bitangents
=
vertexFormat
.
bitangent
?
new
Float32Array
(
size
)
:
void
0
;
const
attr
=
{
normals
,
tangents
,
bitangents
};
let
front
=
0
;
let
back
=
size
-
1
;
let
UL
,
LL
,
UR
,
LR
;
let
normal
=
cartesian1
;
let
left
=
cartesian2
;
let
rightPos
,
leftPos
;
const
halfLength
=
endPositionLength
/
2
;
const
indices
=
IndexDatatype_default
.
createTypedArray
(
size
/
3
,
indicesLength
);
let
index
=
0
;
if
(
addEndPositions
)
{
leftPos
=
cartesian3
;
rightPos
=
cartesian4
;
const
firstEndPositions
=
endPositions
[
0
];
normal
=
Cartesian3_default
.
fromArray
(
computedNormals
,
0
,
normal
);
left
=
Cartesian3_default
.
fromArray
(
computedLefts
,
0
,
left
);
for
(
i
=
0
;
i
<
halfLength
;
i
++
)
{
leftPos
=
Cartesian3_default
.
fromArray
(
firstEndPositions
,
(
halfLength
-
1
-
i
)
*
3
,
leftPos
);
rightPos
=
Cartesian3_default
.
fromArray
(
firstEndPositions
,
(
halfLength
+
i
)
*
3
,
rightPos
);
CorridorGeometryLibrary_default
.
addAttribute
(
finalPositions
,
rightPos
,
front
);
CorridorGeometryLibrary_default
.
addAttribute
(
finalPositions
,
leftPos
,
void
0
,
back
);
addNormals
(
attr
,
normal
,
left
,
front
,
back
,
vertexFormat
);
LL
=
front
/
3
;
LR
=
LL
+
1
;
UL
=
(
back
-
2
)
/
3
;
UR
=
UL
-
1
;
indices
[
index
++
]
=
UL
;
indices
[
index
++
]
=
LL
;
indices
[
index
++
]
=
UR
;
indices
[
index
++
]
=
UR
;
indices
[
index
++
]
=
LL
;
indices
[
index
++
]
=
LR
;
front
+=
3
;
back
-=
3
;
}
}
let
posIndex
=
0
;
let
compIndex
=
0
;
let
rightEdge
=
positions
[
posIndex
++
];
let
leftEdge
=
positions
[
posIndex
++
];
finalPositions
.
set
(
rightEdge
,
front
);
finalPositions
.
set
(
leftEdge
,
back
-
leftEdge
.
length
+
1
);
left
=
Cartesian3_default
.
fromArray
(
computedLefts
,
compIndex
,
left
);
let
rightNormal
;
let
leftNormal
;
length
=
leftEdge
.
length
-
3
;
for
(
i
=
0
;
i
<
length
;
i
+=
3
)
{
rightNormal
=
ellipsoid
.
geodeticSurfaceNormal
(
Cartesian3_default
.
fromArray
(
rightEdge
,
i
,
scratch1
),
scratch1
);
leftNormal
=
ellipsoid
.
geodeticSurfaceNormal
(
Cartesian3_default
.
fromArray
(
leftEdge
,
length
-
i
,
scratch2
),
scratch2
);
normal
=
Cartesian3_default
.
normalize
(
Cartesian3_default
.
add
(
rightNormal
,
leftNormal
,
normal
),
normal
);
addNormals
(
attr
,
normal
,
left
,
front
,
back
,
vertexFormat
);
LL
=
front
/
3
;
LR
=
LL
+
1
;
UL
=
(
back
-
2
)
/
3
;
UR
=
UL
-
1
;
indices
[
index
++
]
=
UL
;
indices
[
index
++
]
=
LL
;
indices
[
index
++
]
=
UR
;
indices
[
index
++
]
=
UR
;
indices
[
index
++
]
=
LL
;
indices
[
index
++
]
=
LR
;
front
+=
3
;
back
-=
3
;
}
rightNormal
=
ellipsoid
.
geodeticSurfaceNormal
(
Cartesian3_default
.
fromArray
(
rightEdge
,
length
,
scratch1
),
scratch1
);
leftNormal
=
ellipsoid
.
geodeticSurfaceNormal
(
Cartesian3_default
.
fromArray
(
leftEdge
,
length
,
scratch2
),
scratch2
);
normal
=
Cartesian3_default
.
normalize
(
Cartesian3_default
.
add
(
rightNormal
,
leftNormal
,
normal
),
normal
);
compIndex
+=
3
;
for
(
i
=
0
;
i
<
corners
.
length
;
i
++
)
{
let
j
;
corner
=
corners
[
i
];
const
l
=
corner
.
leftPositions
;
const
r
=
corner
.
rightPositions
;
let
pivot
;
let
start
;
let
outsidePoint
=
cartesian6
;
let
previousPoint
=
cartesian3
;
let
nextPoint
=
cartesian4
;
normal
=
Cartesian3_default
.
fromArray
(
computedNormals
,
compIndex
,
normal
);
if
(
defined_default
(
l
))
{
addNormals
(
attr
,
normal
,
left
,
void
0
,
back
,
vertexFormat
);
back
-=
3
;
pivot
=
LR
;
start
=
UR
;
for
(
j
=
0
;
j
<
l
.
length
/
3
;
j
++
)
{
outsidePoint
=
Cartesian3_default
.
fromArray
(
l
,
j
*
3
,
outsidePoint
);
indices
[
index
++
]
=
pivot
;
indices
[
index
++
]
=
start
-
j
-
1
;
indices
[
index
++
]
=
start
-
j
;
CorridorGeometryLibrary_default
.
addAttribute
(
finalPositions
,
outsidePoint
,
void
0
,
back
);
previousPoint
=
Cartesian3_default
.
fromArray
(
finalPositions
,
(
start
-
j
-
1
)
*
3
,
previousPoint
);
nextPoint
=
Cartesian3_default
.
fromArray
(
finalPositions
,
pivot
*
3
,
nextPoint
);
left
=
Cartesian3_default
.
normalize
(
Cartesian3_default
.
subtract
(
previousPoint
,
nextPoint
,
left
),
left
);
addNormals
(
attr
,
normal
,
left
,
void
0
,
back
,
vertexFormat
);
back
-=
3
;
}
outsidePoint
=
Cartesian3_default
.
fromArray
(
finalPositions
,
pivot
*
3
,
outsidePoint
);
previousPoint
=
Cartesian3_default
.
subtract
(
Cartesian3_default
.
fromArray
(
finalPositions
,
start
*
3
,
previousPoint
),
outsidePoint
,
previousPoint
);
nextPoint
=
Cartesian3_default
.
subtract
(
Cartesian3_default
.
fromArray
(
finalPositions
,
(
start
-
j
)
*
3
,
nextPoint
),
outsidePoint
,
nextPoint
);
left
=
Cartesian3_default
.
normalize
(
Cartesian3_default
.
add
(
previousPoint
,
nextPoint
,
left
),
left
);
addNormals
(
attr
,
normal
,
left
,
front
,
void
0
,
vertexFormat
);
front
+=
3
;
}
else
{
addNormals
(
attr
,
normal
,
left
,
front
,
void
0
,
vertexFormat
);
front
+=
3
;
pivot
=
UR
;
start
=
LR
;
for
(
j
=
0
;
j
<
r
.
length
/
3
;
j
++
)
{
outsidePoint
=
Cartesian3_default
.
fromArray
(
r
,
j
*
3
,
outsidePoint
);
indices
[
index
++
]
=
pivot
;
indices
[
index
++
]
=
start
+
j
;
indices
[
index
++
]
=
start
+
j
+
1
;
CorridorGeometryLibrary_default
.
addAttribute
(
finalPositions
,
outsidePoint
,
front
);
previousPoint
=
Cartesian3_default
.
fromArray
(
finalPositions
,
pivot
*
3
,
previousPoint
);
nextPoint
=
Cartesian3_default
.
fromArray
(
finalPositions
,
(
start
+
j
)
*
3
,
nextPoint
);
left
=
Cartesian3_default
.
normalize
(
Cartesian3_default
.
subtract
(
previousPoint
,
nextPoint
,
left
),
left
);
addNormals
(
attr
,
normal
,
left
,
front
,
void
0
,
vertexFormat
);
front
+=
3
;
}
outsidePoint
=
Cartesian3_default
.
fromArray
(
finalPositions
,
pivot
*
3
,
outsidePoint
);
previousPoint
=
Cartesian3_default
.
subtract
(
Cartesian3_default
.
fromArray
(
finalPositions
,
(
start
+
j
)
*
3
,
previousPoint
),
outsidePoint
,
previousPoint
);
nextPoint
=
Cartesian3_default
.
subtract
(
Cartesian3_default
.
fromArray
(
finalPositions
,
start
*
3
,
nextPoint
),
outsidePoint
,
nextPoint
);
left
=
Cartesian3_default
.
normalize
(
Cartesian3_default
.
negate
(
Cartesian3_default
.
add
(
nextPoint
,
previousPoint
,
left
),
left
),
left
);
addNormals
(
attr
,
normal
,
left
,
void
0
,
back
,
vertexFormat
);
back
-=
3
;
}
rightEdge
=
positions
[
posIndex
++
];
leftEdge
=
positions
[
posIndex
++
];
rightEdge
.
splice
(
0
,
3
);
leftEdge
.
splice
(
leftEdge
.
length
-
3
,
3
);
finalPositions
.
set
(
rightEdge
,
front
);
finalPositions
.
set
(
leftEdge
,
back
-
leftEdge
.
length
+
1
);
length
=
leftEdge
.
length
-
3
;
compIndex
+=
3
;
left
=
Cartesian3_default
.
fromArray
(
computedLefts
,
compIndex
,
left
);
for
(
j
=
0
;
j
<
leftEdge
.
length
;
j
+=
3
)
{
rightNormal
=
ellipsoid
.
geodeticSurfaceNormal
(
Cartesian3_default
.
fromArray
(
rightEdge
,
j
,
scratch1
),
scratch1
);
leftNormal
=
ellipsoid
.
geodeticSurfaceNormal
(
Cartesian3_default
.
fromArray
(
leftEdge
,
length
-
j
,
scratch2
),
scratch2
);
normal
=
Cartesian3_default
.
normalize
(
Cartesian3_default
.
add
(
rightNormal
,
leftNormal
,
normal
),
normal
);
addNormals
(
attr
,
normal
,
left
,
front
,
back
,
vertexFormat
);
LR
=
front
/
3
;
LL
=
LR
-
1
;
UR
=
(
back
-
2
)
/
3
;
UL
=
UR
+
1
;
indices
[
index
++
]
=
UL
;
indices
[
index
++
]
=
LL
;
indices
[
index
++
]
=
UR
;
indices
[
index
++
]
=
UR
;
indices
[
index
++
]
=
LL
;
indices
[
index
++
]
=
LR
;
front
+=
3
;
back
-=
3
;
}
front
-=
3
;
back
+=
3
;
}
normal
=
Cartesian3_default
.
fromArray
(
computedNormals
,
computedNormals
.
length
-
3
,
normal
);
addNormals
(
attr
,
normal
,
left
,
front
,
back
,
vertexFormat
);
if
(
addEndPositions
)
{
front
+=
3
;
back
-=
3
;
leftPos
=
cartesian3
;
rightPos
=
cartesian4
;
const
lastEndPositions
=
endPositions
[
1
];
for
(
i
=
0
;
i
<
halfLength
;
i
++
)
{
leftPos
=
Cartesian3_default
.
fromArray
(
lastEndPositions
,
(
endPositionLength
-
i
-
1
)
*
3
,
leftPos
);
rightPos
=
Cartesian3_default
.
fromArray
(
lastEndPositions
,
i
*
3
,
rightPos
);
CorridorGeometryLibrary_default
.
addAttribute
(
finalPositions
,
leftPos
,
void
0
,
back
);
CorridorGeometryLibrary_default
.
addAttribute
(
finalPositions
,
rightPos
,
front
);
addNormals
(
attr
,
normal
,
left
,
front
,
back
,
vertexFormat
);
LR
=
front
/
3
;
LL
=
LR
-
1
;
UR
=
(
back
-
2
)
/
3
;
UL
=
UR
+
1
;
indices
[
index
++
]
=
UL
;
indices
[
index
++
]
=
LL
;
indices
[
index
++
]
=
UR
;
indices
[
index
++
]
=
UR
;
indices
[
index
++
]
=
LL
;
indices
[
index
++
]
=
LR
;
front
+=
3
;
back
-=
3
;
}
}
attributes
.
position
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
DOUBLE
,
componentsPerAttribute
:
3
,
values
:
finalPositions
});
if
(
vertexFormat
.
st
)
{
const
st
=
new
Float32Array
(
size
/
3
*
2
);
let
rightSt
;
let
leftSt
;
let
stIndex
=
0
;
if
(
addEndPositions
)
{
leftCount
/=
3
;
rightCount
/=
3
;
const
theta
=
Math
.
PI
/
(
endPositionLength
+
1
);
leftSt
=
1
/
(
leftCount
-
endPositionLength
+
1
);
rightSt
=
1
/
(
rightCount
-
endPositionLength
+
1
);
let
a
;
const
halfEndPos
=
endPositionLength
/
2
;
for
(
i
=
halfEndPos
+
1
;
i
<
endPositionLength
+
1
;
i
++
)
{
a
=
Math_default
.
PI_OVER_TWO
+
theta
*
i
;
st
[
stIndex
++
]
=
rightSt
*
(
1
+
Math
.
cos
(
a
));
st
[
stIndex
++
]
=
0.5
*
(
1
+
Math
.
sin
(
a
));
}
for
(
i
=
1
;
i
<
rightCount
-
endPositionLength
+
1
;
i
++
)
{
st
[
stIndex
++
]
=
i
*
rightSt
;
st
[
stIndex
++
]
=
0
;
}
for
(
i
=
endPositionLength
;
i
>
halfEndPos
;
i
--
)
{
a
=
Math_default
.
PI_OVER_TWO
-
i
*
theta
;
st
[
stIndex
++
]
=
1
-
rightSt
*
(
1
+
Math
.
cos
(
a
));
st
[
stIndex
++
]
=
0.5
*
(
1
+
Math
.
sin
(
a
));
}
for
(
i
=
halfEndPos
;
i
>
0
;
i
--
)
{
a
=
Math_default
.
PI_OVER_TWO
-
theta
*
i
;
st
[
stIndex
++
]
=
1
-
leftSt
*
(
1
+
Math
.
cos
(
a
));
st
[
stIndex
++
]
=
0.5
*
(
1
+
Math
.
sin
(
a
));
}
for
(
i
=
leftCount
-
endPositionLength
;
i
>
0
;
i
--
)
{
st
[
stIndex
++
]
=
i
*
leftSt
;
st
[
stIndex
++
]
=
1
;
}
for
(
i
=
1
;
i
<
halfEndPos
+
1
;
i
++
)
{
a
=
Math_default
.
PI_OVER_TWO
+
theta
*
i
;
st
[
stIndex
++
]
=
leftSt
*
(
1
+
Math
.
cos
(
a
));
st
[
stIndex
++
]
=
0.5
*
(
1
+
Math
.
sin
(
a
));
}
}
else
{
leftCount
/=
3
;
rightCount
/=
3
;
leftSt
=
1
/
(
leftCount
-
1
);
rightSt
=
1
/
(
rightCount
-
1
);
for
(
i
=
0
;
i
<
rightCount
;
i
++
)
{
st
[
stIndex
++
]
=
i
*
rightSt
;
st
[
stIndex
++
]
=
0
;
}
for
(
i
=
leftCount
;
i
>
0
;
i
--
)
{
st
[
stIndex
++
]
=
(
i
-
1
)
*
leftSt
;
st
[
stIndex
++
]
=
1
;
}
}
attributes
.
st
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
FLOAT
,
componentsPerAttribute
:
2
,
values
:
st
});
}
if
(
vertexFormat
.
normal
)
{
attributes
.
normal
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
FLOAT
,
componentsPerAttribute
:
3
,
values
:
attr
.
normals
});
}
if
(
vertexFormat
.
tangent
)
{
attributes
.
tangent
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
FLOAT
,
componentsPerAttribute
:
3
,
values
:
attr
.
tangents
});
}
if
(
vertexFormat
.
bitangent
)
{
attributes
.
bitangent
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
FLOAT
,
componentsPerAttribute
:
3
,
values
:
attr
.
bitangents
});
}
return
{
attributes
,
indices
};
}
function
extrudedAttributes
(
attributes
,
vertexFormat
)
{
if
(
!
vertexFormat
.
normal
&&
!
vertexFormat
.
tangent
&&
!
vertexFormat
.
bitangent
&&
!
vertexFormat
.
st
)
{
return
attributes
;
}
const
positions
=
attributes
.
position
.
values
;
let
topNormals
;
let
topBitangents
;
if
(
vertexFormat
.
normal
||
vertexFormat
.
bitangent
)
{
topNormals
=
attributes
.
normal
.
values
;
topBitangents
=
attributes
.
bitangent
.
values
;
}
const
size
=
attributes
.
position
.
values
.
length
/
18
;
const
threeSize
=
size
*
3
;
const
twoSize
=
size
*
2
;
const
sixSize
=
threeSize
*
2
;
let
i
;
if
(
vertexFormat
.
normal
||
vertexFormat
.
bitangent
||
vertexFormat
.
tangent
)
{
const
normals
=
vertexFormat
.
normal
?
new
Float32Array
(
threeSize
*
6
)
:
void
0
;
const
tangents
=
vertexFormat
.
tangent
?
new
Float32Array
(
threeSize
*
6
)
:
void
0
;
const
bitangents
=
vertexFormat
.
bitangent
?
new
Float32Array
(
threeSize
*
6
)
:
void
0
;
let
topPosition
=
cartesian1
;
let
bottomPosition
=
cartesian2
;
let
previousPosition
=
cartesian3
;
let
normal
=
cartesian4
;
let
tangent
=
cartesian5
;
let
bitangent
=
cartesian6
;
let
attrIndex
=
sixSize
;
for
(
i
=
0
;
i
<
threeSize
;
i
+=
3
)
{
const
attrIndexOffset
=
attrIndex
+
sixSize
;
topPosition
=
Cartesian3_default
.
fromArray
(
positions
,
i
,
topPosition
);
bottomPosition
=
Cartesian3_default
.
fromArray
(
positions
,
i
+
threeSize
,
bottomPosition
);
previousPosition
=
Cartesian3_default
.
fromArray
(
positions
,
(
i
+
3
)
%
threeSize
,
previousPosition
);
bottomPosition
=
Cartesian3_default
.
subtract
(
bottomPosition
,
topPosition
,
bottomPosition
);
previousPosition
=
Cartesian3_default
.
subtract
(
previousPosition
,
topPosition
,
previousPosition
);
normal
=
Cartesian3_default
.
normalize
(
Cartesian3_default
.
cross
(
bottomPosition
,
previousPosition
,
normal
),
normal
);
if
(
vertexFormat
.
normal
)
{
CorridorGeometryLibrary_default
.
addAttribute
(
normals
,
normal
,
attrIndexOffset
);
CorridorGeometryLibrary_default
.
addAttribute
(
normals
,
normal
,
attrIndexOffset
+
3
);
CorridorGeometryLibrary_default
.
addAttribute
(
normals
,
normal
,
attrIndex
);
CorridorGeometryLibrary_default
.
addAttribute
(
normals
,
normal
,
attrIndex
+
3
);
}
if
(
vertexFormat
.
tangent
||
vertexFormat
.
bitangent
)
{
bitangent
=
Cartesian3_default
.
fromArray
(
topNormals
,
i
,
bitangent
);
if
(
vertexFormat
.
bitangent
)
{
CorridorGeometryLibrary_default
.
addAttribute
(
bitangents
,
bitangent
,
attrIndexOffset
);
CorridorGeometryLibrary_default
.
addAttribute
(
bitangents
,
bitangent
,
attrIndexOffset
+
3
);
CorridorGeometryLibrary_default
.
addAttribute
(
bitangents
,
bitangent
,
attrIndex
);
CorridorGeometryLibrary_default
.
addAttribute
(
bitangents
,
bitangent
,
attrIndex
+
3
);
}
if
(
vertexFormat
.
tangent
)
{
tangent
=
Cartesian3_default
.
normalize
(
Cartesian3_default
.
cross
(
bitangent
,
normal
,
tangent
),
tangent
);
CorridorGeometryLibrary_default
.
addAttribute
(
tangents
,
tangent
,
attrIndexOffset
);
CorridorGeometryLibrary_default
.
addAttribute
(
tangents
,
tangent
,
attrIndexOffset
+
3
);
CorridorGeometryLibrary_default
.
addAttribute
(
tangents
,
tangent
,
attrIndex
);
CorridorGeometryLibrary_default
.
addAttribute
(
tangents
,
tangent
,
attrIndex
+
3
);
}
}
attrIndex
+=
6
;
}
if
(
vertexFormat
.
normal
)
{
normals
.
set
(
topNormals
);
for
(
i
=
0
;
i
<
threeSize
;
i
+=
3
)
{
normals
[
i
+
threeSize
]
=
-
topNormals
[
i
];
normals
[
i
+
threeSize
+
1
]
=
-
topNormals
[
i
+
1
];
normals
[
i
+
threeSize
+
2
]
=
-
topNormals
[
i
+
2
];
}
attributes
.
normal
.
values
=
normals
;
}
else
{
attributes
.
normal
=
void
0
;
}
if
(
vertexFormat
.
bitangent
)
{
bitangents
.
set
(
topBitangents
);
bitangents
.
set
(
topBitangents
,
threeSize
);
attributes
.
bitangent
.
values
=
bitangents
;
}
else
{
attributes
.
bitangent
=
void
0
;
}
if
(
vertexFormat
.
tangent
)
{
const
topTangents
=
attributes
.
tangent
.
values
;
tangents
.
set
(
topTangents
);
tangents
.
set
(
topTangents
,
threeSize
);
attributes
.
tangent
.
values
=
tangents
;
}
}
if
(
vertexFormat
.
st
)
{
const
topSt
=
attributes
.
st
.
values
;
const
st
=
new
Float32Array
(
twoSize
*
6
);
st
.
set
(
topSt
);
st
.
set
(
topSt
,
twoSize
);
let
index
=
twoSize
*
2
;
for
(
let
j
=
0
;
j
<
2
;
j
++
)
{
st
[
index
++
]
=
topSt
[
0
];
st
[
index
++
]
=
topSt
[
1
];
for
(
i
=
2
;
i
<
twoSize
;
i
+=
2
)
{
const
s
=
topSt
[
i
];
const
t
=
topSt
[
i
+
1
];
st
[
index
++
]
=
s
;
st
[
index
++
]
=
t
;
st
[
index
++
]
=
s
;
st
[
index
++
]
=
t
;
}
st
[
index
++
]
=
topSt
[
0
];
st
[
index
++
]
=
topSt
[
1
];
}
attributes
.
st
.
values
=
st
;
}
return
attributes
;
}
function
addWallPositions
(
positions
,
index
,
wallPositions
)
{
wallPositions
[
index
++
]
=
positions
[
0
];
wallPositions
[
index
++
]
=
positions
[
1
];
wallPositions
[
index
++
]
=
positions
[
2
];
for
(
let
i
=
3
;
i
<
positions
.
length
;
i
+=
3
)
{
const
x
=
positions
[
i
];
const
y
=
positions
[
i
+
1
];
const
z
=
positions
[
i
+
2
];
wallPositions
[
index
++
]
=
x
;
wallPositions
[
index
++
]
=
y
;
wallPositions
[
index
++
]
=
z
;
wallPositions
[
index
++
]
=
x
;
wallPositions
[
index
++
]
=
y
;
wallPositions
[
index
++
]
=
z
;
}
wallPositions
[
index
++
]
=
positions
[
0
];
wallPositions
[
index
++
]
=
positions
[
1
];
wallPositions
[
index
++
]
=
positions
[
2
];
return
wallPositions
;
}
function
computePositionsExtruded
(
params
,
vertexFormat
)
{
const
topVertexFormat
=
new
VertexFormat_default
({
position
:
vertexFormat
.
position
,
normal
:
vertexFormat
.
normal
||
vertexFormat
.
bitangent
||
params
.
shadowVolume
,
tangent
:
vertexFormat
.
tangent
,
bitangent
:
vertexFormat
.
normal
||
vertexFormat
.
bitangent
,
st
:
vertexFormat
.
st
});
const
ellipsoid
=
params
.
ellipsoid
;
const
computedPositions
=
CorridorGeometryLibrary_default
.
computePositions
(
params
);
const
attr
=
combine
(
computedPositions
,
topVertexFormat
,
ellipsoid
);
const
height
=
params
.
height
;
const
extrudedHeight
=
params
.
extrudedHeight
;
let
attributes
=
attr
.
attributes
;
const
indices
=
attr
.
indices
;
let
positions
=
attributes
.
position
.
values
;
let
length
=
positions
.
length
;
const
newPositions
=
new
Float64Array
(
length
*
6
);
let
extrudedPositions
=
new
Float64Array
(
length
);
extrudedPositions
.
set
(
positions
);
let
wallPositions
=
new
Float64Array
(
length
*
4
);
positions
=
PolygonPipeline_default
.
scaleToGeodeticHeight
(
positions
,
height
,
ellipsoid
);
wallPositions
=
addWallPositions
(
positions
,
0
,
wallPositions
);
extrudedPositions
=
PolygonPipeline_default
.
scaleToGeodeticHeight
(
extrudedPositions
,
extrudedHeight
,
ellipsoid
);
wallPositions
=
addWallPositions
(
extrudedPositions
,
length
*
2
,
wallPositions
);
newPositions
.
set
(
positions
);
newPositions
.
set
(
extrudedPositions
,
length
);
newPositions
.
set
(
wallPositions
,
length
*
2
);
attributes
.
position
.
values
=
newPositions
;
attributes
=
extrudedAttributes
(
attributes
,
vertexFormat
);
let
i
;
const
size
=
length
/
3
;
if
(
params
.
shadowVolume
)
{
const
topNormals
=
attributes
.
normal
.
values
;
length
=
topNormals
.
length
;
let
extrudeNormals
=
new
Float32Array
(
length
*
6
);
for
(
i
=
0
;
i
<
length
;
i
++
)
{
topNormals
[
i
]
=
-
topNormals
[
i
];
}
extrudeNormals
.
set
(
topNormals
,
length
);
extrudeNormals
=
addWallPositions
(
topNormals
,
length
*
4
,
extrudeNormals
);
attributes
.
extrudeDirection
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
FLOAT
,
componentsPerAttribute
:
3
,
values
:
extrudeNormals
});
if
(
!
vertexFormat
.
normal
)
{
attributes
.
normal
=
void
0
;
}
}
if
(
defined_default
(
params
.
offsetAttribute
))
{
let
applyOffset
=
new
Uint8Array
(
size
*
6
);
if
(
params
.
offsetAttribute
===
GeometryOffsetAttribute_default
.
TOP
)
{
applyOffset
=
applyOffset
.
fill
(
1
,
0
,
size
).
fill
(
1
,
size
*
2
,
size
*
4
);
}
else
{
const
applyOffsetValue
=
params
.
offsetAttribute
===
GeometryOffsetAttribute_default
.
NONE
?
0
:
1
;
applyOffset
=
applyOffset
.
fill
(
applyOffsetValue
);
}
attributes
.
applyOffset
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
UNSIGNED_BYTE
,
componentsPerAttribute
:
1
,
values
:
applyOffset
});
}
const
iLength
=
indices
.
length
;
const
twoSize
=
size
+
size
;
const
newIndices
=
IndexDatatype_default
.
createTypedArray
(
newPositions
.
length
/
3
,
iLength
*
2
+
twoSize
*
3
);
newIndices
.
set
(
indices
);
let
index
=
iLength
;
for
(
i
=
0
;
i
<
iLength
;
i
+=
3
)
{
const
v0
=
indices
[
i
];
const
v1
=
indices
[
i
+
1
];
const
v2
=
indices
[
i
+
2
];
newIndices
[
index
++
]
=
v2
+
size
;
newIndices
[
index
++
]
=
v1
+
size
;
newIndices
[
index
++
]
=
v0
+
size
;
}
let
UL
,
LL
,
UR
,
LR
;
for
(
i
=
0
;
i
<
twoSize
;
i
+=
2
)
{
UL
=
i
+
twoSize
;
LL
=
UL
+
twoSize
;
UR
=
UL
+
1
;
LR
=
LL
+
1
;
newIndices
[
index
++
]
=
UL
;
newIndices
[
index
++
]
=
LL
;
newIndices
[
index
++
]
=
UR
;
newIndices
[
index
++
]
=
UR
;
newIndices
[
index
++
]
=
LL
;
newIndices
[
index
++
]
=
LR
;
}
return
{
attributes
,
indices
:
newIndices
};
}
var
scratchCartesian1
=
new
Cartesian3_default
();
var
scratchCartesian2
=
new
Cartesian3_default
();
var
scratchCartographic
=
new
Cartographic_default
();
function
computeOffsetPoints
(
position1
,
position2
,
ellipsoid
,
halfWidth
,
min
,
max
)
{
const
direction
=
Cartesian3_default
.
subtract
(
position2
,
position1
,
scratchCartesian1
);
Cartesian3_default
.
normalize
(
direction
,
direction
);
const
normal
=
ellipsoid
.
geodeticSurfaceNormal
(
position1
,
scratchCartesian2
);
const
offsetDirection
=
Cartesian3_default
.
cross
(
direction
,
normal
,
scratchCartesian1
);
Cartesian3_default
.
multiplyByScalar
(
offsetDirection
,
halfWidth
,
offsetDirection
);
let
minLat
=
min
.
latitude
;
let
minLon
=
min
.
longitude
;
let
maxLat
=
max
.
latitude
;
let
maxLon
=
max
.
longitude
;
Cartesian3_default
.
add
(
position1
,
offsetDirection
,
scratchCartesian2
);
ellipsoid
.
cartesianToCartographic
(
scratchCartesian2
,
scratchCartographic
);
let
lat
=
scratchCartographic
.
latitude
;
let
lon
=
scratchCartographic
.
longitude
;
minLat
=
Math
.
min
(
minLat
,
lat
);
minLon
=
Math
.
min
(
minLon
,
lon
);
maxLat
=
Math
.
max
(
maxLat
,
lat
);
maxLon
=
Math
.
max
(
maxLon
,
lon
);
Cartesian3_default
.
subtract
(
position1
,
offsetDirection
,
scratchCartesian2
);
ellipsoid
.
cartesianToCartographic
(
scratchCartesian2
,
scratchCartographic
);
lat
=
scratchCartographic
.
latitude
;
lon
=
scratchCartographic
.
longitude
;
minLat
=
Math
.
min
(
minLat
,
lat
);
minLon
=
Math
.
min
(
minLon
,
lon
);
maxLat
=
Math
.
max
(
maxLat
,
lat
);
maxLon
=
Math
.
max
(
maxLon
,
lon
);
min
.
latitude
=
minLat
;
min
.
longitude
=
minLon
;
max
.
latitude
=
maxLat
;
max
.
longitude
=
maxLon
;
}
var
scratchCartesianOffset
=
new
Cartesian3_default
();
var
scratchCartesianEnds
=
new
Cartesian3_default
();
var
scratchCartographicMin
=
new
Cartographic_default
();
var
scratchCartographicMax
=
new
Cartographic_default
();
function
computeRectangle
(
positions
,
ellipsoid
,
width
,
cornerType
,
result
)
{
positions
=
scaleToSurface
(
positions
,
ellipsoid
);
const
cleanPositions
=
arrayRemoveDuplicates_default
(
positions
,
Cartesian3_default
.
equalsEpsilon
);
const
length
=
cleanPositions
.
length
;
if
(
length
<
2
||
width
<=
0
)
{
return
new
Rectangle_default
();
}
const
halfWidth
=
width
*
0.5
;
scratchCartographicMin
.
latitude
=
Number
.
POSITIVE_INFINITY
;
scratchCartographicMin
.
longitude
=
Number
.
POSITIVE_INFINITY
;
scratchCartographicMax
.
latitude
=
Number
.
NEGATIVE_INFINITY
;
scratchCartographicMax
.
longitude
=
Number
.
NEGATIVE_INFINITY
;
let
lat
,
lon
;
if
(
cornerType
===
CornerType_default
.
ROUNDED
)
{
const
first
=
cleanPositions
[
0
];
Cartesian3_default
.
subtract
(
first
,
cleanPositions
[
1
],
scratchCartesianOffset
);
Cartesian3_default
.
normalize
(
scratchCartesianOffset
,
scratchCartesianOffset
);
Cartesian3_default
.
multiplyByScalar
(
scratchCartesianOffset
,
halfWidth
,
scratchCartesianOffset
);
Cartesian3_default
.
add
(
first
,
scratchCartesianOffset
,
scratchCartesianEnds
);
ellipsoid
.
cartesianToCartographic
(
scratchCartesianEnds
,
scratchCartographic
);
lat
=
scratchCartographic
.
latitude
;
lon
=
scratchCartographic
.
longitude
;
scratchCartographicMin
.
latitude
=
Math
.
min
(
scratchCartographicMin
.
latitude
,
lat
);
scratchCartographicMin
.
longitude
=
Math
.
min
(
scratchCartographicMin
.
longitude
,
lon
);
scratchCartographicMax
.
latitude
=
Math
.
max
(
scratchCartographicMax
.
latitude
,
lat
);
scratchCartographicMax
.
longitude
=
Math
.
max
(
scratchCartographicMax
.
longitude
,
lon
);
}
for
(
let
i
=
0
;
i
<
length
-
1
;
++
i
)
{
computeOffsetPoints
(
cleanPositions
[
i
],
cleanPositions
[
i
+
1
],
ellipsoid
,
halfWidth
,
scratchCartographicMin
,
scratchCartographicMax
);
}
const
last
=
cleanPositions
[
length
-
1
];
Cartesian3_default
.
subtract
(
last
,
cleanPositions
[
length
-
2
],
scratchCartesianOffset
);
Cartesian3_default
.
normalize
(
scratchCartesianOffset
,
scratchCartesianOffset
);
Cartesian3_default
.
multiplyByScalar
(
scratchCartesianOffset
,
halfWidth
,
scratchCartesianOffset
);
Cartesian3_default
.
add
(
last
,
scratchCartesianOffset
,
scratchCartesianEnds
);
computeOffsetPoints
(
last
,
scratchCartesianEnds
,
ellipsoid
,
halfWidth
,
scratchCartographicMin
,
scratchCartographicMax
);
if
(
cornerType
===
CornerType_default
.
ROUNDED
)
{
ellipsoid
.
cartesianToCartographic
(
scratchCartesianEnds
,
scratchCartographic
);
lat
=
scratchCartographic
.
latitude
;
lon
=
scratchCartographic
.
longitude
;
scratchCartographicMin
.
latitude
=
Math
.
min
(
scratchCartographicMin
.
latitude
,
lat
);
scratchCartographicMin
.
longitude
=
Math
.
min
(
scratchCartographicMin
.
longitude
,
lon
);
scratchCartographicMax
.
latitude
=
Math
.
max
(
scratchCartographicMax
.
latitude
,
lat
);
scratchCartographicMax
.
longitude
=
Math
.
max
(
scratchCartographicMax
.
longitude
,
lon
);
}
const
rectangle
=
defined_default
(
result
)
?
result
:
new
Rectangle_default
();
rectangle
.
north
=
scratchCartographicMax
.
latitude
;
rectangle
.
south
=
scratchCartographicMin
.
latitude
;
rectangle
.
east
=
scratchCartographicMax
.
longitude
;
rectangle
.
west
=
scratchCartographicMin
.
longitude
;
return
rectangle
;
}
function
CorridorGeometry
(
options
)
{
options
=
defaultValue_default
(
options
,
defaultValue_default
.
EMPTY_OBJECT
);
const
positions
=
options
.
positions
;
const
width
=
options
.
width
;
Check_default
.
defined
(
"
options.positions
"
,
positions
);
Check_default
.
defined
(
"
options.width
"
,
width
);
const
height
=
defaultValue_default
(
options
.
height
,
0
);
const
extrudedHeight
=
defaultValue_default
(
options
.
extrudedHeight
,
height
);
this
.
_positions
=
positions
;
this
.
_ellipsoid
=
Ellipsoid_default
.
clone
(
defaultValue_default
(
options
.
ellipsoid
,
Ellipsoid_default
.
default
)
);
this
.
_vertexFormat
=
VertexFormat_default
.
clone
(
defaultValue_default
(
options
.
vertexFormat
,
VertexFormat_default
.
DEFAULT
)
);
this
.
_width
=
width
;
this
.
_height
=
Math
.
max
(
height
,
extrudedHeight
);
this
.
_extrudedHeight
=
Math
.
min
(
height
,
extrudedHeight
);
this
.
_cornerType
=
defaultValue_default
(
options
.
cornerType
,
CornerType_default
.
ROUNDED
);
this
.
_granularity
=
defaultValue_default
(
options
.
granularity
,
Math_default
.
RADIANS_PER_DEGREE
);
this
.
_shadowVolume
=
defaultValue_default
(
options
.
shadowVolume
,
false
);
this
.
_workerName
=
"
createCorridorGeometry
"
;
this
.
_offsetAttribute
=
options
.
offsetAttribute
;
this
.
_rectangle
=
void
0
;
this
.
packedLength
=
1
+
positions
.
length
*
Cartesian3_default
.
packedLength
+
Ellipsoid_default
.
packedLength
+
VertexFormat_default
.
packedLength
+
7
;
}
CorridorGeometry
.
pack
=
function
(
value
,
array
,
startingIndex
)
{
Check_default
.
defined
(
"
value
"
,
value
);
Check_default
.
defined
(
"
array
"
,
array
);
startingIndex
=
defaultValue_default
(
startingIndex
,
0
);
const
positions
=
value
.
_positions
;
const
length
=
positions
.
length
;
array
[
startingIndex
++
]
=
length
;
for
(
let
i
=
0
;
i
<
length
;
++
i
,
startingIndex
+=
Cartesian3_default
.
packedLength
)
{
Cartesian3_default
.
pack
(
positions
[
i
],
array
,
startingIndex
);
}
Ellipsoid_default
.
pack
(
value
.
_ellipsoid
,
array
,
startingIndex
);
startingIndex
+=
Ellipsoid_default
.
packedLength
;
VertexFormat_default
.
pack
(
value
.
_vertexFormat
,
array
,
startingIndex
);
startingIndex
+=
VertexFormat_default
.
packedLength
;
array
[
startingIndex
++
]
=
value
.
_width
;
array
[
startingIndex
++
]
=
value
.
_height
;
array
[
startingIndex
++
]
=
value
.
_extrudedHeight
;
array
[
startingIndex
++
]
=
value
.
_cornerType
;
array
[
startingIndex
++
]
=
value
.
_granularity
;
array
[
startingIndex
++
]
=
value
.
_shadowVolume
?
1
:
0
;
array
[
startingIndex
]
=
defaultValue_default
(
value
.
_offsetAttribute
,
-
1
);
return
array
;
};
var
scratchEllipsoid
=
Ellipsoid_default
.
clone
(
Ellipsoid_default
.
UNIT_SPHERE
);
var
scratchVertexFormat
=
new
VertexFormat_default
();
var
scratchOptions
=
{
positions
:
void
0
,
ellipsoid
:
scratchEllipsoid
,
vertexFormat
:
scratchVertexFormat
,
width
:
void
0
,
height
:
void
0
,
extrudedHeight
:
void
0
,
cornerType
:
void
0
,
granularity
:
void
0
,
shadowVolume
:
void
0
,
offsetAttribute
:
void
0
};
CorridorGeometry
.
unpack
=
function
(
array
,
startingIndex
,
result
)
{
Check_default
.
defined
(
"
array
"
,
array
);
startingIndex
=
defaultValue_default
(
startingIndex
,
0
);
const
length
=
array
[
startingIndex
++
];
const
positions
=
new
Array
(
length
);
for
(
let
i
=
0
;
i
<
length
;
++
i
,
startingIndex
+=
Cartesian3_default
.
packedLength
)
{
positions
[
i
]
=
Cartesian3_default
.
unpack
(
array
,
startingIndex
);
}
const
ellipsoid
=
Ellipsoid_default
.
unpack
(
array
,
startingIndex
,
scratchEllipsoid
);
startingIndex
+=
Ellipsoid_default
.
packedLength
;
const
vertexFormat
=
VertexFormat_default
.
unpack
(
array
,
startingIndex
,
scratchVertexFormat
);
startingIndex
+=
VertexFormat_default
.
packedLength
;
const
width
=
array
[
startingIndex
++
];
const
height
=
array
[
startingIndex
++
];
const
extrudedHeight
=
array
[
startingIndex
++
];
const
cornerType
=
array
[
startingIndex
++
];
const
granularity
=
array
[
startingIndex
++
];
const
shadowVolume
=
array
[
startingIndex
++
]
===
1
;
const
offsetAttribute
=
array
[
startingIndex
];
if
(
!
defined_default
(
result
))
{
scratchOptions
.
positions
=
positions
;
scratchOptions
.
width
=
width
;
scratchOptions
.
height
=
height
;
scratchOptions
.
extrudedHeight
=
extrudedHeight
;
scratchOptions
.
cornerType
=
cornerType
;
scratchOptions
.
granularity
=
granularity
;
scratchOptions
.
shadowVolume
=
shadowVolume
;
scratchOptions
.
offsetAttribute
=
offsetAttribute
===
-
1
?
void
0
:
offsetAttribute
;
return
new
CorridorGeometry
(
scratchOptions
);
}
result
.
_positions
=
positions
;
result
.
_ellipsoid
=
Ellipsoid_default
.
clone
(
ellipsoid
,
result
.
_ellipsoid
);
result
.
_vertexFormat
=
VertexFormat_default
.
clone
(
vertexFormat
,
result
.
_vertexFormat
);
result
.
_width
=
width
;
result
.
_height
=
height
;
result
.
_extrudedHeight
=
extrudedHeight
;
result
.
_cornerType
=
cornerType
;
result
.
_granularity
=
granularity
;
result
.
_shadowVolume
=
shadowVolume
;
result
.
_offsetAttribute
=
offsetAttribute
===
-
1
?
void
0
:
offsetAttribute
;
return
result
;
};
CorridorGeometry
.
computeRectangle
=
function
(
options
,
result
)
{
options
=
defaultValue_default
(
options
,
defaultValue_default
.
EMPTY_OBJECT
);
const
positions
=
options
.
positions
;
const
width
=
options
.
width
;
Check_default
.
defined
(
"
options.positions
"
,
positions
);
Check_default
.
defined
(
"
options.width
"
,
width
);
const
ellipsoid
=
defaultValue_default
(
options
.
ellipsoid
,
Ellipsoid_default
.
default
);
const
cornerType
=
defaultValue_default
(
options
.
cornerType
,
CornerType_default
.
ROUNDED
);
return
computeRectangle
(
positions
,
ellipsoid
,
width
,
cornerType
,
result
);
};
CorridorGeometry
.
createGeometry
=
function
(
corridorGeometry
)
{
let
positions
=
corridorGeometry
.
_positions
;
const
width
=
corridorGeometry
.
_width
;
const
ellipsoid
=
corridorGeometry
.
_ellipsoid
;
positions
=
scaleToSurface
(
positions
,
ellipsoid
);
const
cleanPositions
=
arrayRemoveDuplicates_default
(
positions
,
Cartesian3_default
.
equalsEpsilon
);
if
(
cleanPositions
.
length
<
2
||
width
<=
0
)
{
return
;
}
const
height
=
corridorGeometry
.
_height
;
const
extrudedHeight
=
corridorGeometry
.
_extrudedHeight
;
const
extrude
=
!
Math_default
.
equalsEpsilon
(
height
,
extrudedHeight
,
0
,
Math_default
.
EPSILON2
);
const
vertexFormat
=
corridorGeometry
.
_vertexFormat
;
const
params
=
{
ellipsoid
,
positions
:
cleanPositions
,
width
,
cornerType
:
corridorGeometry
.
_cornerType
,
granularity
:
corridorGeometry
.
_granularity
,
saveAttributes
:
true
};
let
attr
;
if
(
extrude
)
{
params
.
height
=
height
;
params
.
extrudedHeight
=
extrudedHeight
;
params
.
shadowVolume
=
corridorGeometry
.
_shadowVolume
;
params
.
offsetAttribute
=
corridorGeometry
.
_offsetAttribute
;
attr
=
computePositionsExtruded
(
params
,
vertexFormat
);
}
else
{
const
computedPositions
=
CorridorGeometryLibrary_default
.
computePositions
(
params
);
attr
=
combine
(
computedPositions
,
vertexFormat
,
ellipsoid
);
attr
.
attributes
.
position
.
values
=
PolygonPipeline_default
.
scaleToGeodeticHeight
(
attr
.
attributes
.
position
.
values
,
height
,
ellipsoid
);
if
(
defined_default
(
corridorGeometry
.
_offsetAttribute
))
{
const
applyOffsetValue
=
corridorGeometry
.
_offsetAttribute
===
GeometryOffsetAttribute_default
.
NONE
?
0
:
1
;
const
length
=
attr
.
attributes
.
position
.
values
.
length
;
const
applyOffset
=
new
Uint8Array
(
length
/
3
).
fill
(
applyOffsetValue
);
attr
.
attributes
.
applyOffset
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
UNSIGNED_BYTE
,
componentsPerAttribute
:
1
,
values
:
applyOffset
});
}
}
const
attributes
=
attr
.
attributes
;
const
boundingSphere
=
BoundingSphere_default
.
fromVertices
(
attributes
.
position
.
values
,
void
0
,
3
);
if
(
!
vertexFormat
.
position
)
{
attr
.
attributes
.
position
.
values
=
void
0
;
}
return
new
Geometry_default
({
attributes
,
indices
:
attr
.
indices
,
primitiveType
:
PrimitiveType_default
.
TRIANGLES
,
boundingSphere
,
offsetAttribute
:
corridorGeometry
.
_offsetAttribute
});
};
CorridorGeometry
.
createShadowVolume
=
function
(
corridorGeometry
,
minHeightFunc
,
maxHeightFunc
)
{
const
granularity
=
corridorGeometry
.
_granularity
;
const
ellipsoid
=
corridorGeometry
.
_ellipsoid
;
const
minHeight
=
minHeightFunc
(
granularity
,
ellipsoid
);
const
maxHeight
=
maxHeightFunc
(
granularity
,
ellipsoid
);
return
new
CorridorGeometry
({
positions
:
corridorGeometry
.
_positions
,
width
:
corridorGeometry
.
_width
,
cornerType
:
corridorGeometry
.
_cornerType
,
ellipsoid
,
granularity
,
extrudedHeight
:
minHeight
,
height
:
maxHeight
,
vertexFormat
:
VertexFormat_default
.
POSITION_ONLY
,
shadowVolume
:
true
});
};
Object
.
defineProperties
(
CorridorGeometry
.
prototype
,
{
/**
* @private
*/
rectangle
:
{
get
:
function
()
{
if
(
!
defined_default
(
this
.
_rectangle
))
{
this
.
_rectangle
=
computeRectangle
(
this
.
_positions
,
this
.
_ellipsoid
,
this
.
_width
,
this
.
_cornerType
);
}
return
this
.
_rectangle
;
}
},
/**
* For remapping texture coordinates when rendering CorridorGeometries as GroundPrimitives.
*
* Corridors don't support stRotation,
* so just return the corners of the original system.
* @private
*/
textureCoordinateRotationPoints
:
{
get
:
function
()
{
return
[
0
,
0
,
0
,
1
,
1
,
0
];
}
}
});
var
CorridorGeometry_default
=
CorridorGeometry
;
// packages/engine/Source/Workers/createCorridorGeometry.js
function
createCorridorGeometry
(
corridorGeometry
,
offset
)
{
if
(
defined_default
(
offset
))
{
corridorGeometry
=
CorridorGeometry_default
.
unpack
(
corridorGeometry
,
offset
);
}
corridorGeometry
.
_ellipsoid
=
Ellipsoid_default
.
clone
(
corridorGeometry
.
_ellipsoid
);
return
CorridorGeometry_default
.
createGeometry
(
corridorGeometry
);
}
var
createCorridorGeometry_default
=
createCorridorGeometry
;
export
{
createCorridorGeometry_default
as
default
};
public/assets/cesium/Workers/createCorridorOutlineGeometry.js
0 → 100644
View file @
155e1be1
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import
{
CorridorGeometryLibrary_default
}
from
"
./chunk-EJVGYGLF.js
"
;
import
{
CornerType_default
}
from
"
./chunk-3IFRSGEY.js
"
;
import
"
./chunk-QN6TBED4.js
"
;
import
"
./chunk-C3EQ27WF.js
"
;
import
{
GeometryOffsetAttribute_default
}
from
"
./chunk-GBT7MJ6X.js
"
;
import
"
./chunk-YK3QIKY7.js
"
;
import
"
./chunk-NDDI2LWR.js
"
;
import
{
PolygonPipeline_default
}
from
"
./chunk-TI3TRKIC.js
"
;
import
{
arrayRemoveDuplicates_default
}
from
"
./chunk-57H6I3SV.js
"
;
import
"
./chunk-JSQJDZI4.js
"
;
import
"
./chunk-QQOZO7KO.js
"
;
import
"
./chunk-EDLRS3AW.js
"
;
import
{
IndexDatatype_default
}
from
"
./chunk-C4WPMOKT.js
"
;
import
{
GeometryAttributes_default
}
from
"
./chunk-X7IQYYHF.js
"
;
import
{
GeometryAttribute_default
,
Geometry_default
,
PrimitiveType_default
}
from
"
./chunk-JXVLNVXC.js
"
;
import
{
BoundingSphere_default
}
from
"
./chunk-KHZNBFOH.js
"
;
import
"
./chunk-6SQMLVGV.js
"
;
import
{
ComponentDatatype_default
}
from
"
./chunk-XIUSRWL6.js
"
;
import
{
Cartesian3_default
,
Ellipsoid_default
}
from
"
./chunk-FFLMY4TE.js
"
;
import
{
Math_default
}
from
"
./chunk-WGDFYAGC.js
"
;
import
"
./chunk-3HQMMUPU.js
"
;
import
"
./chunk-LLAF3CPH.js
"
;
import
{
defaultValue_default
}
from
"
./chunk-U5HSOKPQ.js
"
;
import
{
Check_default
}
from
"
./chunk-P6TRGU3S.js
"
;
import
{
defined_default
}
from
"
./chunk-YCDZX5LS.js
"
;
// packages/engine/Source/Core/CorridorOutlineGeometry.js
var
cartesian1
=
new
Cartesian3_default
();
var
cartesian2
=
new
Cartesian3_default
();
var
cartesian3
=
new
Cartesian3_default
();
function
scaleToSurface
(
positions
,
ellipsoid
)
{
for
(
let
i
=
0
;
i
<
positions
.
length
;
i
++
)
{
positions
[
i
]
=
ellipsoid
.
scaleToGeodeticSurface
(
positions
[
i
],
positions
[
i
]);
}
return
positions
;
}
function
combine
(
computedPositions
,
cornerType
)
{
const
wallIndices
=
[];
const
positions
=
computedPositions
.
positions
;
const
corners
=
computedPositions
.
corners
;
const
endPositions
=
computedPositions
.
endPositions
;
const
attributes
=
new
GeometryAttributes_default
();
let
corner
;
let
leftCount
=
0
;
let
rightCount
=
0
;
let
i
;
let
indicesLength
=
0
;
let
length
;
for
(
i
=
0
;
i
<
positions
.
length
;
i
+=
2
)
{
length
=
positions
[
i
].
length
-
3
;
leftCount
+=
length
;
indicesLength
+=
length
/
3
*
4
;
rightCount
+=
positions
[
i
+
1
].
length
-
3
;
}
leftCount
+=
3
;
rightCount
+=
3
;
for
(
i
=
0
;
i
<
corners
.
length
;
i
++
)
{
corner
=
corners
[
i
];
const
leftSide
=
corners
[
i
].
leftPositions
;
if
(
defined_default
(
leftSide
))
{
length
=
leftSide
.
length
;
leftCount
+=
length
;
indicesLength
+=
length
/
3
*
2
;
}
else
{
length
=
corners
[
i
].
rightPositions
.
length
;
rightCount
+=
length
;
indicesLength
+=
length
/
3
*
2
;
}
}
const
addEndPositions
=
defined_default
(
endPositions
);
let
endPositionLength
;
if
(
addEndPositions
)
{
endPositionLength
=
endPositions
[
0
].
length
-
3
;
leftCount
+=
endPositionLength
;
rightCount
+=
endPositionLength
;
endPositionLength
/=
3
;
indicesLength
+=
endPositionLength
*
4
;
}
const
size
=
leftCount
+
rightCount
;
const
finalPositions
=
new
Float64Array
(
size
);
let
front
=
0
;
let
back
=
size
-
1
;
let
UL
,
LL
,
UR
,
LR
;
let
rightPos
,
leftPos
;
const
halfLength
=
endPositionLength
/
2
;
const
indices
=
IndexDatatype_default
.
createTypedArray
(
size
/
3
,
indicesLength
+
4
);
let
index
=
0
;
indices
[
index
++
]
=
front
/
3
;
indices
[
index
++
]
=
(
back
-
2
)
/
3
;
if
(
addEndPositions
)
{
wallIndices
.
push
(
front
/
3
);
leftPos
=
cartesian1
;
rightPos
=
cartesian2
;
const
firstEndPositions
=
endPositions
[
0
];
for
(
i
=
0
;
i
<
halfLength
;
i
++
)
{
leftPos
=
Cartesian3_default
.
fromArray
(
firstEndPositions
,
(
halfLength
-
1
-
i
)
*
3
,
leftPos
);
rightPos
=
Cartesian3_default
.
fromArray
(
firstEndPositions
,
(
halfLength
+
i
)
*
3
,
rightPos
);
CorridorGeometryLibrary_default
.
addAttribute
(
finalPositions
,
rightPos
,
front
);
CorridorGeometryLibrary_default
.
addAttribute
(
finalPositions
,
leftPos
,
void
0
,
back
);
LL
=
front
/
3
;
LR
=
LL
+
1
;
UL
=
(
back
-
2
)
/
3
;
UR
=
UL
-
1
;
indices
[
index
++
]
=
UL
;
indices
[
index
++
]
=
UR
;
indices
[
index
++
]
=
LL
;
indices
[
index
++
]
=
LR
;
front
+=
3
;
back
-=
3
;
}
}
let
posIndex
=
0
;
let
rightEdge
=
positions
[
posIndex
++
];
let
leftEdge
=
positions
[
posIndex
++
];
finalPositions
.
set
(
rightEdge
,
front
);
finalPositions
.
set
(
leftEdge
,
back
-
leftEdge
.
length
+
1
);
length
=
leftEdge
.
length
-
3
;
wallIndices
.
push
(
front
/
3
,
(
back
-
2
)
/
3
);
for
(
i
=
0
;
i
<
length
;
i
+=
3
)
{
LL
=
front
/
3
;
LR
=
LL
+
1
;
UL
=
(
back
-
2
)
/
3
;
UR
=
UL
-
1
;
indices
[
index
++
]
=
UL
;
indices
[
index
++
]
=
UR
;
indices
[
index
++
]
=
LL
;
indices
[
index
++
]
=
LR
;
front
+=
3
;
back
-=
3
;
}
for
(
i
=
0
;
i
<
corners
.
length
;
i
++
)
{
let
j
;
corner
=
corners
[
i
];
const
l
=
corner
.
leftPositions
;
const
r
=
corner
.
rightPositions
;
let
start
;
let
outsidePoint
=
cartesian3
;
if
(
defined_default
(
l
))
{
back
-=
3
;
start
=
UR
;
wallIndices
.
push
(
LR
);
for
(
j
=
0
;
j
<
l
.
length
/
3
;
j
++
)
{
outsidePoint
=
Cartesian3_default
.
fromArray
(
l
,
j
*
3
,
outsidePoint
);
indices
[
index
++
]
=
start
-
j
-
1
;
indices
[
index
++
]
=
start
-
j
;
CorridorGeometryLibrary_default
.
addAttribute
(
finalPositions
,
outsidePoint
,
void
0
,
back
);
back
-=
3
;
}
wallIndices
.
push
(
start
-
Math
.
floor
(
l
.
length
/
6
));
if
(
cornerType
===
CornerType_default
.
BEVELED
)
{
wallIndices
.
push
((
back
-
2
)
/
3
+
1
);
}
front
+=
3
;
}
else
{
front
+=
3
;
start
=
LR
;
wallIndices
.
push
(
UR
);
for
(
j
=
0
;
j
<
r
.
length
/
3
;
j
++
)
{
outsidePoint
=
Cartesian3_default
.
fromArray
(
r
,
j
*
3
,
outsidePoint
);
indices
[
index
++
]
=
start
+
j
;
indices
[
index
++
]
=
start
+
j
+
1
;
CorridorGeometryLibrary_default
.
addAttribute
(
finalPositions
,
outsidePoint
,
front
);
front
+=
3
;
}
wallIndices
.
push
(
start
+
Math
.
floor
(
r
.
length
/
6
));
if
(
cornerType
===
CornerType_default
.
BEVELED
)
{
wallIndices
.
push
(
front
/
3
-
1
);
}
back
-=
3
;
}
rightEdge
=
positions
[
posIndex
++
];
leftEdge
=
positions
[
posIndex
++
];
rightEdge
.
splice
(
0
,
3
);
leftEdge
.
splice
(
leftEdge
.
length
-
3
,
3
);
finalPositions
.
set
(
rightEdge
,
front
);
finalPositions
.
set
(
leftEdge
,
back
-
leftEdge
.
length
+
1
);
length
=
leftEdge
.
length
-
3
;
for
(
j
=
0
;
j
<
leftEdge
.
length
;
j
+=
3
)
{
LR
=
front
/
3
;
LL
=
LR
-
1
;
UR
=
(
back
-
2
)
/
3
;
UL
=
UR
+
1
;
indices
[
index
++
]
=
UL
;
indices
[
index
++
]
=
UR
;
indices
[
index
++
]
=
LL
;
indices
[
index
++
]
=
LR
;
front
+=
3
;
back
-=
3
;
}
front
-=
3
;
back
+=
3
;
wallIndices
.
push
(
front
/
3
,
(
back
-
2
)
/
3
);
}
if
(
addEndPositions
)
{
front
+=
3
;
back
-=
3
;
leftPos
=
cartesian1
;
rightPos
=
cartesian2
;
const
lastEndPositions
=
endPositions
[
1
];
for
(
i
=
0
;
i
<
halfLength
;
i
++
)
{
leftPos
=
Cartesian3_default
.
fromArray
(
lastEndPositions
,
(
endPositionLength
-
i
-
1
)
*
3
,
leftPos
);
rightPos
=
Cartesian3_default
.
fromArray
(
lastEndPositions
,
i
*
3
,
rightPos
);
CorridorGeometryLibrary_default
.
addAttribute
(
finalPositions
,
leftPos
,
void
0
,
back
);
CorridorGeometryLibrary_default
.
addAttribute
(
finalPositions
,
rightPos
,
front
);
LR
=
front
/
3
;
LL
=
LR
-
1
;
UR
=
(
back
-
2
)
/
3
;
UL
=
UR
+
1
;
indices
[
index
++
]
=
UL
;
indices
[
index
++
]
=
UR
;
indices
[
index
++
]
=
LL
;
indices
[
index
++
]
=
LR
;
front
+=
3
;
back
-=
3
;
}
wallIndices
.
push
(
front
/
3
);
}
else
{
wallIndices
.
push
(
front
/
3
,
(
back
-
2
)
/
3
);
}
indices
[
index
++
]
=
front
/
3
;
indices
[
index
++
]
=
(
back
-
2
)
/
3
;
attributes
.
position
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
DOUBLE
,
componentsPerAttribute
:
3
,
values
:
finalPositions
});
return
{
attributes
,
indices
,
wallIndices
};
}
function
computePositionsExtruded
(
params
)
{
const
ellipsoid
=
params
.
ellipsoid
;
const
computedPositions
=
CorridorGeometryLibrary_default
.
computePositions
(
params
);
const
attr
=
combine
(
computedPositions
,
params
.
cornerType
);
const
wallIndices
=
attr
.
wallIndices
;
const
height
=
params
.
height
;
const
extrudedHeight
=
params
.
extrudedHeight
;
const
attributes
=
attr
.
attributes
;
const
indices
=
attr
.
indices
;
let
positions
=
attributes
.
position
.
values
;
let
length
=
positions
.
length
;
let
extrudedPositions
=
new
Float64Array
(
length
);
extrudedPositions
.
set
(
positions
);
const
newPositions
=
new
Float64Array
(
length
*
2
);
positions
=
PolygonPipeline_default
.
scaleToGeodeticHeight
(
positions
,
height
,
ellipsoid
);
extrudedPositions
=
PolygonPipeline_default
.
scaleToGeodeticHeight
(
extrudedPositions
,
extrudedHeight
,
ellipsoid
);
newPositions
.
set
(
positions
);
newPositions
.
set
(
extrudedPositions
,
length
);
attributes
.
position
.
values
=
newPositions
;
length
/=
3
;
if
(
defined_default
(
params
.
offsetAttribute
))
{
let
applyOffset
=
new
Uint8Array
(
length
*
2
);
if
(
params
.
offsetAttribute
===
GeometryOffsetAttribute_default
.
TOP
)
{
applyOffset
=
applyOffset
.
fill
(
1
,
0
,
length
);
}
else
{
const
applyOffsetValue
=
params
.
offsetAttribute
===
GeometryOffsetAttribute_default
.
NONE
?
0
:
1
;
applyOffset
=
applyOffset
.
fill
(
applyOffsetValue
);
}
attributes
.
applyOffset
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
UNSIGNED_BYTE
,
componentsPerAttribute
:
1
,
values
:
applyOffset
});
}
let
i
;
const
iLength
=
indices
.
length
;
const
newIndices
=
IndexDatatype_default
.
createTypedArray
(
newPositions
.
length
/
3
,
(
iLength
+
wallIndices
.
length
)
*
2
);
newIndices
.
set
(
indices
);
let
index
=
iLength
;
for
(
i
=
0
;
i
<
iLength
;
i
+=
2
)
{
const
v0
=
indices
[
i
];
const
v1
=
indices
[
i
+
1
];
newIndices
[
index
++
]
=
v0
+
length
;
newIndices
[
index
++
]
=
v1
+
length
;
}
let
UL
,
LL
;
for
(
i
=
0
;
i
<
wallIndices
.
length
;
i
++
)
{
UL
=
wallIndices
[
i
];
LL
=
UL
+
length
;
newIndices
[
index
++
]
=
UL
;
newIndices
[
index
++
]
=
LL
;
}
return
{
attributes
,
indices
:
newIndices
};
}
function
CorridorOutlineGeometry
(
options
)
{
options
=
defaultValue_default
(
options
,
defaultValue_default
.
EMPTY_OBJECT
);
const
positions
=
options
.
positions
;
const
width
=
options
.
width
;
Check_default
.
typeOf
.
object
(
"
options.positions
"
,
positions
);
Check_default
.
typeOf
.
number
(
"
options.width
"
,
width
);
const
height
=
defaultValue_default
(
options
.
height
,
0
);
const
extrudedHeight
=
defaultValue_default
(
options
.
extrudedHeight
,
height
);
this
.
_positions
=
positions
;
this
.
_ellipsoid
=
Ellipsoid_default
.
clone
(
defaultValue_default
(
options
.
ellipsoid
,
Ellipsoid_default
.
default
)
);
this
.
_width
=
width
;
this
.
_height
=
Math
.
max
(
height
,
extrudedHeight
);
this
.
_extrudedHeight
=
Math
.
min
(
height
,
extrudedHeight
);
this
.
_cornerType
=
defaultValue_default
(
options
.
cornerType
,
CornerType_default
.
ROUNDED
);
this
.
_granularity
=
defaultValue_default
(
options
.
granularity
,
Math_default
.
RADIANS_PER_DEGREE
);
this
.
_offsetAttribute
=
options
.
offsetAttribute
;
this
.
_workerName
=
"
createCorridorOutlineGeometry
"
;
this
.
packedLength
=
1
+
positions
.
length
*
Cartesian3_default
.
packedLength
+
Ellipsoid_default
.
packedLength
+
6
;
}
CorridorOutlineGeometry
.
pack
=
function
(
value
,
array
,
startingIndex
)
{
Check_default
.
typeOf
.
object
(
"
value
"
,
value
);
Check_default
.
typeOf
.
object
(
"
array
"
,
array
);
startingIndex
=
defaultValue_default
(
startingIndex
,
0
);
const
positions
=
value
.
_positions
;
const
length
=
positions
.
length
;
array
[
startingIndex
++
]
=
length
;
for
(
let
i
=
0
;
i
<
length
;
++
i
,
startingIndex
+=
Cartesian3_default
.
packedLength
)
{
Cartesian3_default
.
pack
(
positions
[
i
],
array
,
startingIndex
);
}
Ellipsoid_default
.
pack
(
value
.
_ellipsoid
,
array
,
startingIndex
);
startingIndex
+=
Ellipsoid_default
.
packedLength
;
array
[
startingIndex
++
]
=
value
.
_width
;
array
[
startingIndex
++
]
=
value
.
_height
;
array
[
startingIndex
++
]
=
value
.
_extrudedHeight
;
array
[
startingIndex
++
]
=
value
.
_cornerType
;
array
[
startingIndex
++
]
=
value
.
_granularity
;
array
[
startingIndex
]
=
defaultValue_default
(
value
.
_offsetAttribute
,
-
1
);
return
array
;
};
var
scratchEllipsoid
=
Ellipsoid_default
.
clone
(
Ellipsoid_default
.
UNIT_SPHERE
);
var
scratchOptions
=
{
positions
:
void
0
,
ellipsoid
:
scratchEllipsoid
,
width
:
void
0
,
height
:
void
0
,
extrudedHeight
:
void
0
,
cornerType
:
void
0
,
granularity
:
void
0
,
offsetAttribute
:
void
0
};
CorridorOutlineGeometry
.
unpack
=
function
(
array
,
startingIndex
,
result
)
{
Check_default
.
typeOf
.
object
(
"
array
"
,
array
);
startingIndex
=
defaultValue_default
(
startingIndex
,
0
);
const
length
=
array
[
startingIndex
++
];
const
positions
=
new
Array
(
length
);
for
(
let
i
=
0
;
i
<
length
;
++
i
,
startingIndex
+=
Cartesian3_default
.
packedLength
)
{
positions
[
i
]
=
Cartesian3_default
.
unpack
(
array
,
startingIndex
);
}
const
ellipsoid
=
Ellipsoid_default
.
unpack
(
array
,
startingIndex
,
scratchEllipsoid
);
startingIndex
+=
Ellipsoid_default
.
packedLength
;
const
width
=
array
[
startingIndex
++
];
const
height
=
array
[
startingIndex
++
];
const
extrudedHeight
=
array
[
startingIndex
++
];
const
cornerType
=
array
[
startingIndex
++
];
const
granularity
=
array
[
startingIndex
++
];
const
offsetAttribute
=
array
[
startingIndex
];
if
(
!
defined_default
(
result
))
{
scratchOptions
.
positions
=
positions
;
scratchOptions
.
width
=
width
;
scratchOptions
.
height
=
height
;
scratchOptions
.
extrudedHeight
=
extrudedHeight
;
scratchOptions
.
cornerType
=
cornerType
;
scratchOptions
.
granularity
=
granularity
;
scratchOptions
.
offsetAttribute
=
offsetAttribute
===
-
1
?
void
0
:
offsetAttribute
;
return
new
CorridorOutlineGeometry
(
scratchOptions
);
}
result
.
_positions
=
positions
;
result
.
_ellipsoid
=
Ellipsoid_default
.
clone
(
ellipsoid
,
result
.
_ellipsoid
);
result
.
_width
=
width
;
result
.
_height
=
height
;
result
.
_extrudedHeight
=
extrudedHeight
;
result
.
_cornerType
=
cornerType
;
result
.
_granularity
=
granularity
;
result
.
_offsetAttribute
=
offsetAttribute
===
-
1
?
void
0
:
offsetAttribute
;
return
result
;
};
CorridorOutlineGeometry
.
createGeometry
=
function
(
corridorOutlineGeometry
)
{
let
positions
=
corridorOutlineGeometry
.
_positions
;
const
width
=
corridorOutlineGeometry
.
_width
;
const
ellipsoid
=
corridorOutlineGeometry
.
_ellipsoid
;
positions
=
scaleToSurface
(
positions
,
ellipsoid
);
const
cleanPositions
=
arrayRemoveDuplicates_default
(
positions
,
Cartesian3_default
.
equalsEpsilon
);
if
(
cleanPositions
.
length
<
2
||
width
<=
0
)
{
return
;
}
const
height
=
corridorOutlineGeometry
.
_height
;
const
extrudedHeight
=
corridorOutlineGeometry
.
_extrudedHeight
;
const
extrude
=
!
Math_default
.
equalsEpsilon
(
height
,
extrudedHeight
,
0
,
Math_default
.
EPSILON2
);
const
params
=
{
ellipsoid
,
positions
:
cleanPositions
,
width
,
cornerType
:
corridorOutlineGeometry
.
_cornerType
,
granularity
:
corridorOutlineGeometry
.
_granularity
,
saveAttributes
:
false
};
let
attr
;
if
(
extrude
)
{
params
.
height
=
height
;
params
.
extrudedHeight
=
extrudedHeight
;
params
.
offsetAttribute
=
corridorOutlineGeometry
.
_offsetAttribute
;
attr
=
computePositionsExtruded
(
params
);
}
else
{
const
computedPositions
=
CorridorGeometryLibrary_default
.
computePositions
(
params
);
attr
=
combine
(
computedPositions
,
params
.
cornerType
);
attr
.
attributes
.
position
.
values
=
PolygonPipeline_default
.
scaleToGeodeticHeight
(
attr
.
attributes
.
position
.
values
,
height
,
ellipsoid
);
if
(
defined_default
(
corridorOutlineGeometry
.
_offsetAttribute
))
{
const
length
=
attr
.
attributes
.
position
.
values
.
length
;
const
offsetValue
=
corridorOutlineGeometry
.
_offsetAttribute
===
GeometryOffsetAttribute_default
.
NONE
?
0
:
1
;
const
applyOffset
=
new
Uint8Array
(
length
/
3
).
fill
(
offsetValue
);
attr
.
attributes
.
applyOffset
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
UNSIGNED_BYTE
,
componentsPerAttribute
:
1
,
values
:
applyOffset
});
}
}
const
attributes
=
attr
.
attributes
;
const
boundingSphere
=
BoundingSphere_default
.
fromVertices
(
attributes
.
position
.
values
,
void
0
,
3
);
return
new
Geometry_default
({
attributes
,
indices
:
attr
.
indices
,
primitiveType
:
PrimitiveType_default
.
LINES
,
boundingSphere
,
offsetAttribute
:
corridorOutlineGeometry
.
_offsetAttribute
});
};
var
CorridorOutlineGeometry_default
=
CorridorOutlineGeometry
;
// packages/engine/Source/Workers/createCorridorOutlineGeometry.js
function
createCorridorOutlineGeometry
(
corridorOutlineGeometry
,
offset
)
{
if
(
defined_default
(
offset
))
{
corridorOutlineGeometry
=
CorridorOutlineGeometry_default
.
unpack
(
corridorOutlineGeometry
,
offset
);
}
corridorOutlineGeometry
.
_ellipsoid
=
Ellipsoid_default
.
clone
(
corridorOutlineGeometry
.
_ellipsoid
);
return
CorridorOutlineGeometry_default
.
createGeometry
(
corridorOutlineGeometry
);
}
var
createCorridorOutlineGeometry_default
=
createCorridorOutlineGeometry
;
export
{
createCorridorOutlineGeometry_default
as
default
};
public/assets/cesium/Workers/createCylinderGeometry.js
0 → 100644
View file @
155e1be1
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import
{
CylinderGeometry_default
}
from
"
./chunk-L5GODJAR.js
"
;
import
"
./chunk-O72GZTSE.js
"
;
import
"
./chunk-GBT7MJ6X.js
"
;
import
"
./chunk-JBSKHTNX.js
"
;
import
"
./chunk-C4WPMOKT.js
"
;
import
"
./chunk-X7IQYYHF.js
"
;
import
"
./chunk-JXVLNVXC.js
"
;
import
"
./chunk-KHZNBFOH.js
"
;
import
"
./chunk-6SQMLVGV.js
"
;
import
"
./chunk-XIUSRWL6.js
"
;
import
"
./chunk-FFLMY4TE.js
"
;
import
"
./chunk-WGDFYAGC.js
"
;
import
"
./chunk-3HQMMUPU.js
"
;
import
"
./chunk-LLAF3CPH.js
"
;
import
"
./chunk-U5HSOKPQ.js
"
;
import
"
./chunk-P6TRGU3S.js
"
;
import
{
defined_default
}
from
"
./chunk-YCDZX5LS.js
"
;
// packages/engine/Source/Workers/createCylinderGeometry.js
function
createCylinderGeometry
(
cylinderGeometry
,
offset
)
{
if
(
defined_default
(
offset
))
{
cylinderGeometry
=
CylinderGeometry_default
.
unpack
(
cylinderGeometry
,
offset
);
}
return
CylinderGeometry_default
.
createGeometry
(
cylinderGeometry
);
}
var
createCylinderGeometry_default
=
createCylinderGeometry
;
export
{
createCylinderGeometry_default
as
default
};
public/assets/cesium/Workers/createCylinderOutlineGeometry.js
0 → 100644
View file @
155e1be1
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import
{
CylinderGeometryLibrary_default
}
from
"
./chunk-O72GZTSE.js
"
;
import
{
GeometryOffsetAttribute_default
}
from
"
./chunk-GBT7MJ6X.js
"
;
import
{
IndexDatatype_default
}
from
"
./chunk-C4WPMOKT.js
"
;
import
{
GeometryAttributes_default
}
from
"
./chunk-X7IQYYHF.js
"
;
import
{
GeometryAttribute_default
,
Geometry_default
,
PrimitiveType_default
}
from
"
./chunk-JXVLNVXC.js
"
;
import
{
BoundingSphere_default
}
from
"
./chunk-KHZNBFOH.js
"
;
import
"
./chunk-6SQMLVGV.js
"
;
import
{
ComponentDatatype_default
}
from
"
./chunk-XIUSRWL6.js
"
;
import
{
Cartesian2_default
,
Cartesian3_default
}
from
"
./chunk-FFLMY4TE.js
"
;
import
"
./chunk-WGDFYAGC.js
"
;
import
"
./chunk-3HQMMUPU.js
"
;
import
"
./chunk-LLAF3CPH.js
"
;
import
{
defaultValue_default
}
from
"
./chunk-U5HSOKPQ.js
"
;
import
{
Check_default
,
DeveloperError_default
}
from
"
./chunk-P6TRGU3S.js
"
;
import
{
defined_default
}
from
"
./chunk-YCDZX5LS.js
"
;
// packages/engine/Source/Core/CylinderOutlineGeometry.js
var
radiusScratch
=
new
Cartesian2_default
();
function
CylinderOutlineGeometry
(
options
)
{
options
=
defaultValue_default
(
options
,
defaultValue_default
.
EMPTY_OBJECT
);
const
length
=
options
.
length
;
const
topRadius
=
options
.
topRadius
;
const
bottomRadius
=
options
.
bottomRadius
;
const
slices
=
defaultValue_default
(
options
.
slices
,
128
);
const
numberOfVerticalLines
=
Math
.
max
(
defaultValue_default
(
options
.
numberOfVerticalLines
,
16
),
0
);
Check_default
.
typeOf
.
number
(
"
options.positions
"
,
length
);
Check_default
.
typeOf
.
number
(
"
options.topRadius
"
,
topRadius
);
Check_default
.
typeOf
.
number
(
"
options.bottomRadius
"
,
bottomRadius
);
Check_default
.
typeOf
.
number
.
greaterThanOrEquals
(
"
options.slices
"
,
slices
,
3
);
if
(
defined_default
(
options
.
offsetAttribute
)
&&
options
.
offsetAttribute
===
GeometryOffsetAttribute_default
.
TOP
)
{
throw
new
DeveloperError_default
(
"
GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.
"
);
}
this
.
_length
=
length
;
this
.
_topRadius
=
topRadius
;
this
.
_bottomRadius
=
bottomRadius
;
this
.
_slices
=
slices
;
this
.
_numberOfVerticalLines
=
numberOfVerticalLines
;
this
.
_offsetAttribute
=
options
.
offsetAttribute
;
this
.
_workerName
=
"
createCylinderOutlineGeometry
"
;
}
CylinderOutlineGeometry
.
packedLength
=
6
;
CylinderOutlineGeometry
.
pack
=
function
(
value
,
array
,
startingIndex
)
{
Check_default
.
typeOf
.
object
(
"
value
"
,
value
);
Check_default
.
defined
(
"
array
"
,
array
);
startingIndex
=
defaultValue_default
(
startingIndex
,
0
);
array
[
startingIndex
++
]
=
value
.
_length
;
array
[
startingIndex
++
]
=
value
.
_topRadius
;
array
[
startingIndex
++
]
=
value
.
_bottomRadius
;
array
[
startingIndex
++
]
=
value
.
_slices
;
array
[
startingIndex
++
]
=
value
.
_numberOfVerticalLines
;
array
[
startingIndex
]
=
defaultValue_default
(
value
.
_offsetAttribute
,
-
1
);
return
array
;
};
var
scratchOptions
=
{
length
:
void
0
,
topRadius
:
void
0
,
bottomRadius
:
void
0
,
slices
:
void
0
,
numberOfVerticalLines
:
void
0
,
offsetAttribute
:
void
0
};
CylinderOutlineGeometry
.
unpack
=
function
(
array
,
startingIndex
,
result
)
{
Check_default
.
defined
(
"
array
"
,
array
);
startingIndex
=
defaultValue_default
(
startingIndex
,
0
);
const
length
=
array
[
startingIndex
++
];
const
topRadius
=
array
[
startingIndex
++
];
const
bottomRadius
=
array
[
startingIndex
++
];
const
slices
=
array
[
startingIndex
++
];
const
numberOfVerticalLines
=
array
[
startingIndex
++
];
const
offsetAttribute
=
array
[
startingIndex
];
if
(
!
defined_default
(
result
))
{
scratchOptions
.
length
=
length
;
scratchOptions
.
topRadius
=
topRadius
;
scratchOptions
.
bottomRadius
=
bottomRadius
;
scratchOptions
.
slices
=
slices
;
scratchOptions
.
numberOfVerticalLines
=
numberOfVerticalLines
;
scratchOptions
.
offsetAttribute
=
offsetAttribute
===
-
1
?
void
0
:
offsetAttribute
;
return
new
CylinderOutlineGeometry
(
scratchOptions
);
}
result
.
_length
=
length
;
result
.
_topRadius
=
topRadius
;
result
.
_bottomRadius
=
bottomRadius
;
result
.
_slices
=
slices
;
result
.
_numberOfVerticalLines
=
numberOfVerticalLines
;
result
.
_offsetAttribute
=
offsetAttribute
===
-
1
?
void
0
:
offsetAttribute
;
return
result
;
};
CylinderOutlineGeometry
.
createGeometry
=
function
(
cylinderGeometry
)
{
let
length
=
cylinderGeometry
.
_length
;
const
topRadius
=
cylinderGeometry
.
_topRadius
;
const
bottomRadius
=
cylinderGeometry
.
_bottomRadius
;
const
slices
=
cylinderGeometry
.
_slices
;
const
numberOfVerticalLines
=
cylinderGeometry
.
_numberOfVerticalLines
;
if
(
length
<=
0
||
topRadius
<
0
||
bottomRadius
<
0
||
topRadius
===
0
&&
bottomRadius
===
0
)
{
return
;
}
const
numVertices
=
slices
*
2
;
const
positions
=
CylinderGeometryLibrary_default
.
computePositions
(
length
,
topRadius
,
bottomRadius
,
slices
,
false
);
let
numIndices
=
slices
*
2
;
let
numSide
;
if
(
numberOfVerticalLines
>
0
)
{
const
numSideLines
=
Math
.
min
(
numberOfVerticalLines
,
slices
);
numSide
=
Math
.
round
(
slices
/
numSideLines
);
numIndices
+=
numSideLines
;
}
const
indices
=
IndexDatatype_default
.
createTypedArray
(
numVertices
,
numIndices
*
2
);
let
index
=
0
;
let
i
;
for
(
i
=
0
;
i
<
slices
-
1
;
i
++
)
{
indices
[
index
++
]
=
i
;
indices
[
index
++
]
=
i
+
1
;
indices
[
index
++
]
=
i
+
slices
;
indices
[
index
++
]
=
i
+
1
+
slices
;
}
indices
[
index
++
]
=
slices
-
1
;
indices
[
index
++
]
=
0
;
indices
[
index
++
]
=
slices
+
slices
-
1
;
indices
[
index
++
]
=
slices
;
if
(
numberOfVerticalLines
>
0
)
{
for
(
i
=
0
;
i
<
slices
;
i
+=
numSide
)
{
indices
[
index
++
]
=
i
;
indices
[
index
++
]
=
i
+
slices
;
}
}
const
attributes
=
new
GeometryAttributes_default
();
attributes
.
position
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
DOUBLE
,
componentsPerAttribute
:
3
,
values
:
positions
});
radiusScratch
.
x
=
length
*
0.5
;
radiusScratch
.
y
=
Math
.
max
(
bottomRadius
,
topRadius
);
const
boundingSphere
=
new
BoundingSphere_default
(
Cartesian3_default
.
ZERO
,
Cartesian2_default
.
magnitude
(
radiusScratch
)
);
if
(
defined_default
(
cylinderGeometry
.
_offsetAttribute
))
{
length
=
positions
.
length
;
const
offsetValue
=
cylinderGeometry
.
_offsetAttribute
===
GeometryOffsetAttribute_default
.
NONE
?
0
:
1
;
const
applyOffset
=
new
Uint8Array
(
length
/
3
).
fill
(
offsetValue
);
attributes
.
applyOffset
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
UNSIGNED_BYTE
,
componentsPerAttribute
:
1
,
values
:
applyOffset
});
}
return
new
Geometry_default
({
attributes
,
indices
,
primitiveType
:
PrimitiveType_default
.
LINES
,
boundingSphere
,
offsetAttribute
:
cylinderGeometry
.
_offsetAttribute
});
};
var
CylinderOutlineGeometry_default
=
CylinderOutlineGeometry
;
// packages/engine/Source/Workers/createCylinderOutlineGeometry.js
function
createCylinderOutlineGeometry
(
cylinderGeometry
,
offset
)
{
if
(
defined_default
(
offset
))
{
cylinderGeometry
=
CylinderOutlineGeometry_default
.
unpack
(
cylinderGeometry
,
offset
);
}
return
CylinderOutlineGeometry_default
.
createGeometry
(
cylinderGeometry
);
}
var
createCylinderOutlineGeometry_default
=
createCylinderOutlineGeometry
;
export
{
createCylinderOutlineGeometry_default
as
default
};
public/assets/cesium/Workers/createEllipseGeometry.js
0 → 100644
View file @
155e1be1
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import
{
EllipseGeometry_default
}
from
"
./chunk-ZVUUPJEM.js
"
;
import
"
./chunk-JISPSEF3.js
"
;
import
"
./chunk-YSIJTJ7N.js
"
;
import
"
./chunk-7ZZ5LMZY.js
"
;
import
"
./chunk-LJ2JQHJT.js
"
;
import
"
./chunk-NGZJIN5Z.js
"
;
import
"
./chunk-GBT7MJ6X.js
"
;
import
"
./chunk-JBSKHTNX.js
"
;
import
"
./chunk-QQOZO7KO.js
"
;
import
"
./chunk-EDLRS3AW.js
"
;
import
"
./chunk-C4WPMOKT.js
"
;
import
"
./chunk-X7IQYYHF.js
"
;
import
"
./chunk-JXVLNVXC.js
"
;
import
"
./chunk-KHZNBFOH.js
"
;
import
"
./chunk-6SQMLVGV.js
"
;
import
"
./chunk-XIUSRWL6.js
"
;
import
{
Cartesian3_default
,
Ellipsoid_default
}
from
"
./chunk-FFLMY4TE.js
"
;
import
"
./chunk-WGDFYAGC.js
"
;
import
"
./chunk-3HQMMUPU.js
"
;
import
"
./chunk-LLAF3CPH.js
"
;
import
"
./chunk-U5HSOKPQ.js
"
;
import
"
./chunk-P6TRGU3S.js
"
;
import
{
defined_default
}
from
"
./chunk-YCDZX5LS.js
"
;
// packages/engine/Source/Workers/createEllipseGeometry.js
function
createEllipseGeometry
(
ellipseGeometry
,
offset
)
{
if
(
defined_default
(
offset
))
{
ellipseGeometry
=
EllipseGeometry_default
.
unpack
(
ellipseGeometry
,
offset
);
}
ellipseGeometry
.
_center
=
Cartesian3_default
.
clone
(
ellipseGeometry
.
_center
);
ellipseGeometry
.
_ellipsoid
=
Ellipsoid_default
.
clone
(
ellipseGeometry
.
_ellipsoid
);
return
EllipseGeometry_default
.
createGeometry
(
ellipseGeometry
);
}
var
createEllipseGeometry_default
=
createEllipseGeometry
;
export
{
createEllipseGeometry_default
as
default
};
public/assets/cesium/Workers/createEllipseOutlineGeometry.js
0 → 100644
View file @
155e1be1
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import
{
EllipseOutlineGeometry_default
}
from
"
./chunk-2LOWCAMW.js
"
;
import
"
./chunk-JISPSEF3.js
"
;
import
"
./chunk-GBT7MJ6X.js
"
;
import
"
./chunk-C4WPMOKT.js
"
;
import
"
./chunk-X7IQYYHF.js
"
;
import
"
./chunk-JXVLNVXC.js
"
;
import
"
./chunk-KHZNBFOH.js
"
;
import
"
./chunk-6SQMLVGV.js
"
;
import
"
./chunk-XIUSRWL6.js
"
;
import
{
Cartesian3_default
,
Ellipsoid_default
}
from
"
./chunk-FFLMY4TE.js
"
;
import
"
./chunk-WGDFYAGC.js
"
;
import
"
./chunk-3HQMMUPU.js
"
;
import
"
./chunk-LLAF3CPH.js
"
;
import
"
./chunk-U5HSOKPQ.js
"
;
import
"
./chunk-P6TRGU3S.js
"
;
import
{
defined_default
}
from
"
./chunk-YCDZX5LS.js
"
;
// packages/engine/Source/Workers/createEllipseOutlineGeometry.js
function
createEllipseOutlineGeometry
(
ellipseGeometry
,
offset
)
{
if
(
defined_default
(
offset
))
{
ellipseGeometry
=
EllipseOutlineGeometry_default
.
unpack
(
ellipseGeometry
,
offset
);
}
ellipseGeometry
.
_center
=
Cartesian3_default
.
clone
(
ellipseGeometry
.
_center
);
ellipseGeometry
.
_ellipsoid
=
Ellipsoid_default
.
clone
(
ellipseGeometry
.
_ellipsoid
);
return
EllipseOutlineGeometry_default
.
createGeometry
(
ellipseGeometry
);
}
var
createEllipseOutlineGeometry_default
=
createEllipseOutlineGeometry
;
export
{
createEllipseOutlineGeometry_default
as
default
};
public/assets/cesium/Workers/createEllipsoidGeometry.js
0 → 100644
View file @
155e1be1
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import
{
EllipsoidGeometry_default
}
from
"
./chunk-IZGUQO6Q.js
"
;
import
"
./chunk-GBT7MJ6X.js
"
;
import
"
./chunk-JBSKHTNX.js
"
;
import
"
./chunk-C4WPMOKT.js
"
;
import
"
./chunk-X7IQYYHF.js
"
;
import
"
./chunk-JXVLNVXC.js
"
;
import
"
./chunk-KHZNBFOH.js
"
;
import
"
./chunk-6SQMLVGV.js
"
;
import
"
./chunk-XIUSRWL6.js
"
;
import
"
./chunk-FFLMY4TE.js
"
;
import
"
./chunk-WGDFYAGC.js
"
;
import
"
./chunk-3HQMMUPU.js
"
;
import
"
./chunk-LLAF3CPH.js
"
;
import
"
./chunk-U5HSOKPQ.js
"
;
import
"
./chunk-P6TRGU3S.js
"
;
import
{
defined_default
}
from
"
./chunk-YCDZX5LS.js
"
;
// packages/engine/Source/Workers/createEllipsoidGeometry.js
function
createEllipsoidGeometry
(
ellipsoidGeometry
,
offset
)
{
if
(
defined_default
(
offset
))
{
ellipsoidGeometry
=
EllipsoidGeometry_default
.
unpack
(
ellipsoidGeometry
,
offset
);
}
return
EllipsoidGeometry_default
.
createGeometry
(
ellipsoidGeometry
);
}
var
createEllipsoidGeometry_default
=
createEllipsoidGeometry
;
export
{
createEllipsoidGeometry_default
as
default
};
public/assets/cesium/Workers/createEllipsoidOutlineGeometry.js
0 → 100644
View file @
155e1be1
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import
{
EllipsoidOutlineGeometry_default
}
from
"
./chunk-OPP2SKMA.js
"
;
import
"
./chunk-GBT7MJ6X.js
"
;
import
"
./chunk-C4WPMOKT.js
"
;
import
"
./chunk-X7IQYYHF.js
"
;
import
"
./chunk-JXVLNVXC.js
"
;
import
"
./chunk-KHZNBFOH.js
"
;
import
"
./chunk-6SQMLVGV.js
"
;
import
"
./chunk-XIUSRWL6.js
"
;
import
"
./chunk-FFLMY4TE.js
"
;
import
"
./chunk-WGDFYAGC.js
"
;
import
"
./chunk-3HQMMUPU.js
"
;
import
"
./chunk-LLAF3CPH.js
"
;
import
"
./chunk-U5HSOKPQ.js
"
;
import
"
./chunk-P6TRGU3S.js
"
;
import
{
defined_default
}
from
"
./chunk-YCDZX5LS.js
"
;
// packages/engine/Source/Workers/createEllipsoidOutlineGeometry.js
function
createEllipsoidOutlineGeometry
(
ellipsoidGeometry
,
offset
)
{
if
(
defined_default
(
ellipsoidGeometry
.
buffer
,
offset
))
{
ellipsoidGeometry
=
EllipsoidOutlineGeometry_default
.
unpack
(
ellipsoidGeometry
,
offset
);
}
return
EllipsoidOutlineGeometry_default
.
createGeometry
(
ellipsoidGeometry
);
}
var
createEllipsoidOutlineGeometry_default
=
createEllipsoidOutlineGeometry
;
export
{
createEllipsoidOutlineGeometry_default
as
default
};
public/assets/cesium/Workers/createFrustumGeometry.js
0 → 100644
View file @
155e1be1
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import
{
FrustumGeometry_default
}
from
"
./chunk-7YIOHQWH.js
"
;
import
"
./chunk-JBSKHTNX.js
"
;
import
"
./chunk-EDLRS3AW.js
"
;
import
"
./chunk-X7IQYYHF.js
"
;
import
"
./chunk-JXVLNVXC.js
"
;
import
"
./chunk-KHZNBFOH.js
"
;
import
"
./chunk-6SQMLVGV.js
"
;
import
"
./chunk-XIUSRWL6.js
"
;
import
"
./chunk-FFLMY4TE.js
"
;
import
"
./chunk-WGDFYAGC.js
"
;
import
"
./chunk-3HQMMUPU.js
"
;
import
"
./chunk-LLAF3CPH.js
"
;
import
"
./chunk-U5HSOKPQ.js
"
;
import
"
./chunk-P6TRGU3S.js
"
;
import
{
defined_default
}
from
"
./chunk-YCDZX5LS.js
"
;
// packages/engine/Source/Workers/createFrustumGeometry.js
function
createFrustumGeometry
(
frustumGeometry
,
offset
)
{
if
(
defined_default
(
offset
))
{
frustumGeometry
=
FrustumGeometry_default
.
unpack
(
frustumGeometry
,
offset
);
}
return
FrustumGeometry_default
.
createGeometry
(
frustumGeometry
);
}
var
createFrustumGeometry_default
=
createFrustumGeometry
;
export
{
createFrustumGeometry_default
as
default
};
public/assets/cesium/Workers/createFrustumOutlineGeometry.js
0 → 100644
View file @
155e1be1
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import
{
FrustumGeometry_default
,
OrthographicFrustum_default
,
PerspectiveFrustum_default
}
from
"
./chunk-7YIOHQWH.js
"
;
import
"
./chunk-JBSKHTNX.js
"
;
import
"
./chunk-EDLRS3AW.js
"
;
import
{
GeometryAttributes_default
}
from
"
./chunk-X7IQYYHF.js
"
;
import
{
GeometryAttribute_default
,
Geometry_default
,
PrimitiveType_default
}
from
"
./chunk-JXVLNVXC.js
"
;
import
{
BoundingSphere_default
}
from
"
./chunk-KHZNBFOH.js
"
;
import
{
Quaternion_default
}
from
"
./chunk-6SQMLVGV.js
"
;
import
{
ComponentDatatype_default
}
from
"
./chunk-XIUSRWL6.js
"
;
import
{
Cartesian3_default
}
from
"
./chunk-FFLMY4TE.js
"
;
import
"
./chunk-WGDFYAGC.js
"
;
import
"
./chunk-3HQMMUPU.js
"
;
import
"
./chunk-LLAF3CPH.js
"
;
import
{
defaultValue_default
}
from
"
./chunk-U5HSOKPQ.js
"
;
import
{
Check_default
}
from
"
./chunk-P6TRGU3S.js
"
;
import
{
defined_default
}
from
"
./chunk-YCDZX5LS.js
"
;
// packages/engine/Source/Core/FrustumOutlineGeometry.js
var
PERSPECTIVE
=
0
;
var
ORTHOGRAPHIC
=
1
;
function
FrustumOutlineGeometry
(
options
)
{
Check_default
.
typeOf
.
object
(
"
options
"
,
options
);
Check_default
.
typeOf
.
object
(
"
options.frustum
"
,
options
.
frustum
);
Check_default
.
typeOf
.
object
(
"
options.origin
"
,
options
.
origin
);
Check_default
.
typeOf
.
object
(
"
options.orientation
"
,
options
.
orientation
);
const
frustum
=
options
.
frustum
;
const
orientation
=
options
.
orientation
;
const
origin
=
options
.
origin
;
const
drawNearPlane
=
defaultValue_default
(
options
.
_drawNearPlane
,
true
);
let
frustumType
;
let
frustumPackedLength
;
if
(
frustum
instanceof
PerspectiveFrustum_default
)
{
frustumType
=
PERSPECTIVE
;
frustumPackedLength
=
PerspectiveFrustum_default
.
packedLength
;
}
else
if
(
frustum
instanceof
OrthographicFrustum_default
)
{
frustumType
=
ORTHOGRAPHIC
;
frustumPackedLength
=
OrthographicFrustum_default
.
packedLength
;
}
this
.
_frustumType
=
frustumType
;
this
.
_frustum
=
frustum
.
clone
();
this
.
_origin
=
Cartesian3_default
.
clone
(
origin
);
this
.
_orientation
=
Quaternion_default
.
clone
(
orientation
);
this
.
_drawNearPlane
=
drawNearPlane
;
this
.
_workerName
=
"
createFrustumOutlineGeometry
"
;
this
.
packedLength
=
2
+
frustumPackedLength
+
Cartesian3_default
.
packedLength
+
Quaternion_default
.
packedLength
;
}
FrustumOutlineGeometry
.
pack
=
function
(
value
,
array
,
startingIndex
)
{
Check_default
.
typeOf
.
object
(
"
value
"
,
value
);
Check_default
.
defined
(
"
array
"
,
array
);
startingIndex
=
defaultValue_default
(
startingIndex
,
0
);
const
frustumType
=
value
.
_frustumType
;
const
frustum
=
value
.
_frustum
;
array
[
startingIndex
++
]
=
frustumType
;
if
(
frustumType
===
PERSPECTIVE
)
{
PerspectiveFrustum_default
.
pack
(
frustum
,
array
,
startingIndex
);
startingIndex
+=
PerspectiveFrustum_default
.
packedLength
;
}
else
{
OrthographicFrustum_default
.
pack
(
frustum
,
array
,
startingIndex
);
startingIndex
+=
OrthographicFrustum_default
.
packedLength
;
}
Cartesian3_default
.
pack
(
value
.
_origin
,
array
,
startingIndex
);
startingIndex
+=
Cartesian3_default
.
packedLength
;
Quaternion_default
.
pack
(
value
.
_orientation
,
array
,
startingIndex
);
startingIndex
+=
Quaternion_default
.
packedLength
;
array
[
startingIndex
]
=
value
.
_drawNearPlane
?
1
:
0
;
return
array
;
};
var
scratchPackPerspective
=
new
PerspectiveFrustum_default
();
var
scratchPackOrthographic
=
new
OrthographicFrustum_default
();
var
scratchPackQuaternion
=
new
Quaternion_default
();
var
scratchPackorigin
=
new
Cartesian3_default
();
FrustumOutlineGeometry
.
unpack
=
function
(
array
,
startingIndex
,
result
)
{
Check_default
.
defined
(
"
array
"
,
array
);
startingIndex
=
defaultValue_default
(
startingIndex
,
0
);
const
frustumType
=
array
[
startingIndex
++
];
let
frustum
;
if
(
frustumType
===
PERSPECTIVE
)
{
frustum
=
PerspectiveFrustum_default
.
unpack
(
array
,
startingIndex
,
scratchPackPerspective
);
startingIndex
+=
PerspectiveFrustum_default
.
packedLength
;
}
else
{
frustum
=
OrthographicFrustum_default
.
unpack
(
array
,
startingIndex
,
scratchPackOrthographic
);
startingIndex
+=
OrthographicFrustum_default
.
packedLength
;
}
const
origin
=
Cartesian3_default
.
unpack
(
array
,
startingIndex
,
scratchPackorigin
);
startingIndex
+=
Cartesian3_default
.
packedLength
;
const
orientation
=
Quaternion_default
.
unpack
(
array
,
startingIndex
,
scratchPackQuaternion
);
startingIndex
+=
Quaternion_default
.
packedLength
;
const
drawNearPlane
=
array
[
startingIndex
]
===
1
;
if
(
!
defined_default
(
result
))
{
return
new
FrustumOutlineGeometry
({
frustum
,
origin
,
orientation
,
_drawNearPlane
:
drawNearPlane
});
}
const
frustumResult
=
frustumType
===
result
.
_frustumType
?
result
.
_frustum
:
void
0
;
result
.
_frustum
=
frustum
.
clone
(
frustumResult
);
result
.
_frustumType
=
frustumType
;
result
.
_origin
=
Cartesian3_default
.
clone
(
origin
,
result
.
_origin
);
result
.
_orientation
=
Quaternion_default
.
clone
(
orientation
,
result
.
_orientation
);
result
.
_drawNearPlane
=
drawNearPlane
;
return
result
;
};
FrustumOutlineGeometry
.
createGeometry
=
function
(
frustumGeometry
)
{
const
frustumType
=
frustumGeometry
.
_frustumType
;
const
frustum
=
frustumGeometry
.
_frustum
;
const
origin
=
frustumGeometry
.
_origin
;
const
orientation
=
frustumGeometry
.
_orientation
;
const
drawNearPlane
=
frustumGeometry
.
_drawNearPlane
;
const
positions
=
new
Float64Array
(
3
*
4
*
2
);
FrustumGeometry_default
.
_computeNearFarPlanes
(
origin
,
orientation
,
frustumType
,
frustum
,
positions
);
const
attributes
=
new
GeometryAttributes_default
({
position
:
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
DOUBLE
,
componentsPerAttribute
:
3
,
values
:
positions
})
});
let
offset
;
let
index
;
const
numberOfPlanes
=
drawNearPlane
?
2
:
1
;
const
indices
=
new
Uint16Array
(
8
*
(
numberOfPlanes
+
1
));
let
i
=
drawNearPlane
?
0
:
1
;
for
(;
i
<
2
;
++
i
)
{
offset
=
drawNearPlane
?
i
*
8
:
0
;
index
=
i
*
4
;
indices
[
offset
]
=
index
;
indices
[
offset
+
1
]
=
index
+
1
;
indices
[
offset
+
2
]
=
index
+
1
;
indices
[
offset
+
3
]
=
index
+
2
;
indices
[
offset
+
4
]
=
index
+
2
;
indices
[
offset
+
5
]
=
index
+
3
;
indices
[
offset
+
6
]
=
index
+
3
;
indices
[
offset
+
7
]
=
index
;
}
for
(
i
=
0
;
i
<
2
;
++
i
)
{
offset
=
(
numberOfPlanes
+
i
)
*
8
;
index
=
i
*
4
;
indices
[
offset
]
=
index
;
indices
[
offset
+
1
]
=
index
+
4
;
indices
[
offset
+
2
]
=
index
+
1
;
indices
[
offset
+
3
]
=
index
+
5
;
indices
[
offset
+
4
]
=
index
+
2
;
indices
[
offset
+
5
]
=
index
+
6
;
indices
[
offset
+
6
]
=
index
+
3
;
indices
[
offset
+
7
]
=
index
+
7
;
}
return
new
Geometry_default
({
attributes
,
indices
,
primitiveType
:
PrimitiveType_default
.
LINES
,
boundingSphere
:
BoundingSphere_default
.
fromVertices
(
positions
)
});
};
var
FrustumOutlineGeometry_default
=
FrustumOutlineGeometry
;
// packages/engine/Source/Workers/createFrustumOutlineGeometry.js
function
createFrustumOutlineGeometry
(
frustumGeometry
,
offset
)
{
if
(
defined_default
(
offset
))
{
frustumGeometry
=
FrustumOutlineGeometry_default
.
unpack
(
frustumGeometry
,
offset
);
}
return
FrustumOutlineGeometry_default
.
createGeometry
(
frustumGeometry
);
}
var
createFrustumOutlineGeometry_default
=
createFrustumOutlineGeometry
;
export
{
createFrustumOutlineGeometry_default
as
default
};
public/assets/cesium/Workers/createGeometry.js
0 → 100644
View file @
155e1be1
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import
{
PrimitivePipeline_default
}
from
"
./chunk-IBRIWOCM.js
"
;
import
{
createTaskProcessorWorker_default
}
from
"
./chunk-Z2QP3CXW.js
"
;
import
"
./chunk-RJM36CNY.js
"
;
import
"
./chunk-7ZZ5LMZY.js
"
;
import
"
./chunk-LJ2JQHJT.js
"
;
import
"
./chunk-NGZJIN5Z.js
"
;
import
"
./chunk-QQOZO7KO.js
"
;
import
"
./chunk-EDLRS3AW.js
"
;
import
"
./chunk-C4WPMOKT.js
"
;
import
"
./chunk-X7IQYYHF.js
"
;
import
"
./chunk-JXVLNVXC.js
"
;
import
"
./chunk-KHZNBFOH.js
"
;
import
"
./chunk-6SQMLVGV.js
"
;
import
"
./chunk-XIUSRWL6.js
"
;
import
"
./chunk-FFLMY4TE.js
"
;
import
"
./chunk-WGDFYAGC.js
"
;
import
"
./chunk-3HQMMUPU.js
"
;
import
"
./chunk-LLAF3CPH.js
"
;
import
{
defaultValue_default
}
from
"
./chunk-U5HSOKPQ.js
"
;
import
{
DeveloperError_default
}
from
"
./chunk-P6TRGU3S.js
"
;
import
{
__glob
,
__require
,
defined_default
}
from
"
./chunk-YCDZX5LS.js
"
;
// import("./**/*.js") in packages/engine/Source/Workers/createGeometry.js
var
globImport_js
=
__glob
({
"
./combineGeometry.js
"
:
()
=>
import
(
"
./combineGeometry.js
"
),
"
./createBoxGeometry.js
"
:
()
=>
import
(
"
./createBoxGeometry.js
"
),
"
./createBoxOutlineGeometry.js
"
:
()
=>
import
(
"
./createBoxOutlineGeometry.js
"
),
"
./createCircleGeometry.js
"
:
()
=>
import
(
"
./createCircleGeometry.js
"
),
"
./createCircleOutlineGeometry.js
"
:
()
=>
import
(
"
./createCircleOutlineGeometry.js
"
),
"
./createCoplanarPolygonGeometry.js
"
:
()
=>
import
(
"
./createCoplanarPolygonGeometry.js
"
),
"
./createCoplanarPolygonOutlineGeometry.js
"
:
()
=>
import
(
"
./createCoplanarPolygonOutlineGeometry.js
"
),
"
./createCorridorGeometry.js
"
:
()
=>
import
(
"
./createCorridorGeometry.js
"
),
"
./createCorridorOutlineGeometry.js
"
:
()
=>
import
(
"
./createCorridorOutlineGeometry.js
"
),
"
./createCylinderGeometry.js
"
:
()
=>
import
(
"
./createCylinderGeometry.js
"
),
"
./createCylinderOutlineGeometry.js
"
:
()
=>
import
(
"
./createCylinderOutlineGeometry.js
"
),
"
./createEllipseGeometry.js
"
:
()
=>
import
(
"
./createEllipseGeometry.js
"
),
"
./createEllipseOutlineGeometry.js
"
:
()
=>
import
(
"
./createEllipseOutlineGeometry.js
"
),
"
./createEllipsoidGeometry.js
"
:
()
=>
import
(
"
./createEllipsoidGeometry.js
"
),
"
./createEllipsoidOutlineGeometry.js
"
:
()
=>
import
(
"
./createEllipsoidOutlineGeometry.js
"
),
"
./createFrustumGeometry.js
"
:
()
=>
import
(
"
./createFrustumGeometry.js
"
),
"
./createFrustumOutlineGeometry.js
"
:
()
=>
import
(
"
./createFrustumOutlineGeometry.js
"
),
"
./createGeometry.js
"
:
()
=>
import
(
"
./createGeometry.js
"
),
"
./createGroundPolylineGeometry.js
"
:
()
=>
import
(
"
./createGroundPolylineGeometry.js
"
),
"
./createPlaneGeometry.js
"
:
()
=>
import
(
"
./createPlaneGeometry.js
"
),
"
./createPlaneOutlineGeometry.js
"
:
()
=>
import
(
"
./createPlaneOutlineGeometry.js
"
),
"
./createPolygonGeometry.js
"
:
()
=>
import
(
"
./createPolygonGeometry.js
"
),
"
./createPolygonOutlineGeometry.js
"
:
()
=>
import
(
"
./createPolygonOutlineGeometry.js
"
),
"
./createPolylineGeometry.js
"
:
()
=>
import
(
"
./createPolylineGeometry.js
"
),
"
./createPolylineVolumeGeometry.js
"
:
()
=>
import
(
"
./createPolylineVolumeGeometry.js
"
),
"
./createPolylineVolumeOutlineGeometry.js
"
:
()
=>
import
(
"
./createPolylineVolumeOutlineGeometry.js
"
),
"
./createRectangleGeometry.js
"
:
()
=>
import
(
"
./createRectangleGeometry.js
"
),
"
./createRectangleOutlineGeometry.js
"
:
()
=>
import
(
"
./createRectangleOutlineGeometry.js
"
),
"
./createSimplePolylineGeometry.js
"
:
()
=>
import
(
"
./createSimplePolylineGeometry.js
"
),
"
./createSphereGeometry.js
"
:
()
=>
import
(
"
./createSphereGeometry.js
"
),
"
./createSphereOutlineGeometry.js
"
:
()
=>
import
(
"
./createSphereOutlineGeometry.js
"
),
"
./createTaskProcessorWorker.js
"
:
()
=>
import
(
"
./createTaskProcessorWorker.js
"
),
"
./createVectorTileClampedPolylines.js
"
:
()
=>
import
(
"
./createVectorTileClampedPolylines.js
"
),
"
./createVectorTileGeometries.js
"
:
()
=>
import
(
"
./createVectorTileGeometries.js
"
),
"
./createVectorTilePoints.js
"
:
()
=>
import
(
"
./createVectorTilePoints.js
"
),
"
./createVectorTilePolygons.js
"
:
()
=>
import
(
"
./createVectorTilePolygons.js
"
),
"
./createVectorTilePolylines.js
"
:
()
=>
import
(
"
./createVectorTilePolylines.js
"
),
"
./createVerticesFromGoogleEarthEnterpriseBuffer.js
"
:
()
=>
import
(
"
./createVerticesFromGoogleEarthEnterpriseBuffer.js
"
),
"
./createVerticesFromHeightmap.js
"
:
()
=>
import
(
"
./createVerticesFromHeightmap.js
"
),
"
./createVerticesFromQuantizedTerrainMesh.js
"
:
()
=>
import
(
"
./createVerticesFromQuantizedTerrainMesh.js
"
),
"
./createWallGeometry.js
"
:
()
=>
import
(
"
./createWallGeometry.js
"
),
"
./createWallOutlineGeometry.js
"
:
()
=>
import
(
"
./createWallOutlineGeometry.js
"
),
"
./decodeDraco.js
"
:
()
=>
import
(
"
./decodeDraco.js
"
),
"
./decodeGoogleEarthEnterprisePacket.js
"
:
()
=>
import
(
"
./decodeGoogleEarthEnterprisePacket.js
"
),
"
./decodeI3S.js
"
:
()
=>
import
(
"
./decodeI3S.js
"
),
"
./transcodeKTX2.js
"
:
()
=>
import
(
"
./transcodeKTX2.js
"
),
"
./transferTypedArrayTest.js
"
:
()
=>
import
(
"
./transferTypedArrayTest.js
"
),
"
./upsampleQuantizedTerrainMesh.js
"
:
()
=>
import
(
"
./upsampleQuantizedTerrainMesh.js
"
)
});
// packages/engine/Source/Workers/createGeometry.js
var
moduleCache
=
{};
async
function
getModule
(
moduleName
,
modulePath
)
{
let
module
=
defaultValue_default
(
moduleCache
[
modulePath
],
moduleCache
[
moduleName
]);
if
(
defined_default
(
module
))
{
return
module
;
}
if
(
defined_default
(
modulePath
))
{
if
(
typeof
exports
===
"
object
"
)
{
module
=
__require
(
modulePath
);
}
else
{
const
result
=
await
import
(
modulePath
);
module
=
result
.
default
;
}
moduleCache
[
modulePath
]
=
module
;
return
module
;
}
if
(
typeof
exports
===
"
object
"
)
{
module
=
__require
(
`Workers/
${
moduleName
}
`
);
}
else
{
const
result
=
defined_default
(
modulePath
)
?
await
import
(
modulePath
)
:
await
globImport_js
(
`./
${
moduleName
}
.js`
);
module
=
result
.
default
;
}
moduleCache
[
moduleName
]
=
module
;
return
module
;
}
async
function
createGeometry
(
parameters
,
transferableObjects
)
{
const
subTasks
=
parameters
.
subTasks
;
const
length
=
subTasks
.
length
;
const
resultsOrPromises
=
new
Array
(
length
);
for
(
let
i
=
0
;
i
<
length
;
i
++
)
{
const
task
=
subTasks
[
i
];
const
geometry
=
task
.
geometry
;
const
moduleName
=
task
.
moduleName
;
const
modulePath
=
task
.
modulePath
;
if
(
defined_default
(
moduleName
)
&&
defined_default
(
modulePath
))
{
throw
new
DeveloperError_default
(
"
Must only set moduleName or modulePath
"
);
}
if
(
defined_default
(
moduleName
)
||
defined_default
(
modulePath
))
{
resultsOrPromises
[
i
]
=
getModule
(
moduleName
,
modulePath
).
then
((
createFunction
)
=>
createFunction
(
geometry
,
task
.
offset
));
}
else
{
resultsOrPromises
[
i
]
=
geometry
;
}
}
return
Promise
.
all
(
resultsOrPromises
).
then
(
function
(
results
)
{
return
PrimitivePipeline_default
.
packCreateGeometryResults
(
results
,
transferableObjects
);
});
}
var
createGeometry_default
=
createTaskProcessorWorker_default
(
createGeometry
);
export
{
createGeometry_default
as
default
};
public/assets/cesium/Workers/createGroundPolylineGeometry.js
0 → 100644
View file @
155e1be1
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import
{
WebMercatorProjection_default
}
from
"
./chunk-RJM36CNY.js
"
;
import
{
ArcType_default
}
from
"
./chunk-XWOUPGUF.js
"
;
import
{
EncodedCartesian3_default
}
from
"
./chunk-NGZJIN5Z.js
"
;
import
{
EllipsoidGeodesic_default
}
from
"
./chunk-C3EQ27WF.js
"
;
import
{
arrayRemoveDuplicates_default
}
from
"
./chunk-57H6I3SV.js
"
;
import
{
EllipsoidRhumbLine_default
}
from
"
./chunk-JSQJDZI4.js
"
;
import
{
IntersectionTests_default
}
from
"
./chunk-QQOZO7KO.js
"
;
import
{
Plane_default
}
from
"
./chunk-EDLRS3AW.js
"
;
import
{
GeometryAttribute_default
,
Geometry_default
}
from
"
./chunk-JXVLNVXC.js
"
;
import
{
BoundingSphere_default
,
GeographicProjection_default
}
from
"
./chunk-KHZNBFOH.js
"
;
import
{
Quaternion_default
,
Rectangle_default
,
Resource_default
,
buildModuleUrl_default
}
from
"
./chunk-6SQMLVGV.js
"
;
import
{
ComponentDatatype_default
}
from
"
./chunk-XIUSRWL6.js
"
;
import
{
Cartesian2_default
,
Cartesian3_default
,
Cartographic_default
,
Ellipsoid_default
,
Matrix3_default
}
from
"
./chunk-FFLMY4TE.js
"
;
import
{
Math_default
}
from
"
./chunk-WGDFYAGC.js
"
;
import
"
./chunk-3HQMMUPU.js
"
;
import
"
./chunk-LLAF3CPH.js
"
;
import
{
defaultValue_default
}
from
"
./chunk-U5HSOKPQ.js
"
;
import
{
Check_default
,
DeveloperError_default
}
from
"
./chunk-P6TRGU3S.js
"
;
import
{
defined_default
}
from
"
./chunk-YCDZX5LS.js
"
;
// packages/engine/Source/Core/GeographicTilingScheme.js
function
GeographicTilingScheme
(
options
)
{
options
=
defaultValue_default
(
options
,
defaultValue_default
.
EMPTY_OBJECT
);
this
.
_ellipsoid
=
defaultValue_default
(
options
.
ellipsoid
,
Ellipsoid_default
.
default
);
this
.
_rectangle
=
defaultValue_default
(
options
.
rectangle
,
Rectangle_default
.
MAX_VALUE
);
this
.
_projection
=
new
GeographicProjection_default
(
this
.
_ellipsoid
);
this
.
_numberOfLevelZeroTilesX
=
defaultValue_default
(
options
.
numberOfLevelZeroTilesX
,
2
);
this
.
_numberOfLevelZeroTilesY
=
defaultValue_default
(
options
.
numberOfLevelZeroTilesY
,
1
);
}
Object
.
defineProperties
(
GeographicTilingScheme
.
prototype
,
{
/**
* Gets the ellipsoid that is tiled by this tiling scheme.
* @memberof GeographicTilingScheme.prototype
* @type {Ellipsoid}
*/
ellipsoid
:
{
get
:
function
()
{
return
this
.
_ellipsoid
;
}
},
/**
* Gets the rectangle, in radians, covered by this tiling scheme.
* @memberof GeographicTilingScheme.prototype
* @type {Rectangle}
*/
rectangle
:
{
get
:
function
()
{
return
this
.
_rectangle
;
}
},
/**
* Gets the map projection used by this tiling scheme.
* @memberof GeographicTilingScheme.prototype
* @type {MapProjection}
*/
projection
:
{
get
:
function
()
{
return
this
.
_projection
;
}
}
});
GeographicTilingScheme
.
prototype
.
getNumberOfXTilesAtLevel
=
function
(
level
)
{
return
this
.
_numberOfLevelZeroTilesX
<<
level
;
};
GeographicTilingScheme
.
prototype
.
getNumberOfYTilesAtLevel
=
function
(
level
)
{
return
this
.
_numberOfLevelZeroTilesY
<<
level
;
};
GeographicTilingScheme
.
prototype
.
rectangleToNativeRectangle
=
function
(
rectangle
,
result
)
{
Check_default
.
defined
(
"
rectangle
"
,
rectangle
);
const
west
=
Math_default
.
toDegrees
(
rectangle
.
west
);
const
south
=
Math_default
.
toDegrees
(
rectangle
.
south
);
const
east
=
Math_default
.
toDegrees
(
rectangle
.
east
);
const
north
=
Math_default
.
toDegrees
(
rectangle
.
north
);
if
(
!
defined_default
(
result
))
{
return
new
Rectangle_default
(
west
,
south
,
east
,
north
);
}
result
.
west
=
west
;
result
.
south
=
south
;
result
.
east
=
east
;
result
.
north
=
north
;
return
result
;
};
GeographicTilingScheme
.
prototype
.
tileXYToNativeRectangle
=
function
(
x
,
y
,
level
,
result
)
{
const
rectangleRadians
=
this
.
tileXYToRectangle
(
x
,
y
,
level
,
result
);
rectangleRadians
.
west
=
Math_default
.
toDegrees
(
rectangleRadians
.
west
);
rectangleRadians
.
south
=
Math_default
.
toDegrees
(
rectangleRadians
.
south
);
rectangleRadians
.
east
=
Math_default
.
toDegrees
(
rectangleRadians
.
east
);
rectangleRadians
.
north
=
Math_default
.
toDegrees
(
rectangleRadians
.
north
);
return
rectangleRadians
;
};
GeographicTilingScheme
.
prototype
.
tileXYToRectangle
=
function
(
x
,
y
,
level
,
result
)
{
const
rectangle
=
this
.
_rectangle
;
const
xTiles
=
this
.
getNumberOfXTilesAtLevel
(
level
);
const
yTiles
=
this
.
getNumberOfYTilesAtLevel
(
level
);
const
xTileWidth
=
rectangle
.
width
/
xTiles
;
const
west
=
x
*
xTileWidth
+
rectangle
.
west
;
const
east
=
(
x
+
1
)
*
xTileWidth
+
rectangle
.
west
;
const
yTileHeight
=
rectangle
.
height
/
yTiles
;
const
north
=
rectangle
.
north
-
y
*
yTileHeight
;
const
south
=
rectangle
.
north
-
(
y
+
1
)
*
yTileHeight
;
if
(
!
defined_default
(
result
))
{
result
=
new
Rectangle_default
(
west
,
south
,
east
,
north
);
}
result
.
west
=
west
;
result
.
south
=
south
;
result
.
east
=
east
;
result
.
north
=
north
;
return
result
;
};
GeographicTilingScheme
.
prototype
.
positionToTileXY
=
function
(
position
,
level
,
result
)
{
const
rectangle
=
this
.
_rectangle
;
if
(
!
Rectangle_default
.
contains
(
rectangle
,
position
))
{
return
void
0
;
}
const
xTiles
=
this
.
getNumberOfXTilesAtLevel
(
level
);
const
yTiles
=
this
.
getNumberOfYTilesAtLevel
(
level
);
const
xTileWidth
=
rectangle
.
width
/
xTiles
;
const
yTileHeight
=
rectangle
.
height
/
yTiles
;
let
longitude
=
position
.
longitude
;
if
(
rectangle
.
east
<
rectangle
.
west
)
{
longitude
+=
Math_default
.
TWO_PI
;
}
let
xTileCoordinate
=
(
longitude
-
rectangle
.
west
)
/
xTileWidth
|
0
;
if
(
xTileCoordinate
>=
xTiles
)
{
xTileCoordinate
=
xTiles
-
1
;
}
let
yTileCoordinate
=
(
rectangle
.
north
-
position
.
latitude
)
/
yTileHeight
|
0
;
if
(
yTileCoordinate
>=
yTiles
)
{
yTileCoordinate
=
yTiles
-
1
;
}
if
(
!
defined_default
(
result
))
{
return
new
Cartesian2_default
(
xTileCoordinate
,
yTileCoordinate
);
}
result
.
x
=
xTileCoordinate
;
result
.
y
=
yTileCoordinate
;
return
result
;
};
var
GeographicTilingScheme_default
=
GeographicTilingScheme
;
// packages/engine/Source/Core/ApproximateTerrainHeights.js
var
scratchDiagonalCartesianNE
=
new
Cartesian3_default
();
var
scratchDiagonalCartesianSW
=
new
Cartesian3_default
();
var
scratchDiagonalCartographic
=
new
Cartographic_default
();
var
scratchCenterCartesian
=
new
Cartesian3_default
();
var
scratchSurfaceCartesian
=
new
Cartesian3_default
();
var
scratchBoundingSphere
=
new
BoundingSphere_default
();
var
tilingScheme
=
new
GeographicTilingScheme_default
();
var
scratchCorners
=
[
new
Cartographic_default
(),
new
Cartographic_default
(),
new
Cartographic_default
(),
new
Cartographic_default
()
];
var
scratchTileXY
=
new
Cartesian2_default
();
var
ApproximateTerrainHeights
=
{};
ApproximateTerrainHeights
.
initialize
=
function
()
{
let
initPromise
=
ApproximateTerrainHeights
.
_initPromise
;
if
(
defined_default
(
initPromise
))
{
return
initPromise
;
}
initPromise
=
Resource_default
.
fetchJson
(
buildModuleUrl_default
(
"
Assets/approximateTerrainHeights.json
"
)
).
then
(
function
(
json
)
{
ApproximateTerrainHeights
.
_terrainHeights
=
json
;
});
ApproximateTerrainHeights
.
_initPromise
=
initPromise
;
return
initPromise
;
};
ApproximateTerrainHeights
.
getMinimumMaximumHeights
=
function
(
rectangle
,
ellipsoid
)
{
Check_default
.
defined
(
"
rectangle
"
,
rectangle
);
if
(
!
defined_default
(
ApproximateTerrainHeights
.
_terrainHeights
))
{
throw
new
DeveloperError_default
(
"
You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function
"
);
}
ellipsoid
=
defaultValue_default
(
ellipsoid
,
Ellipsoid_default
.
default
);
const
xyLevel
=
getTileXYLevel
(
rectangle
);
let
minTerrainHeight
=
ApproximateTerrainHeights
.
_defaultMinTerrainHeight
;
let
maxTerrainHeight
=
ApproximateTerrainHeights
.
_defaultMaxTerrainHeight
;
if
(
defined_default
(
xyLevel
))
{
const
key
=
`
${
xyLevel
.
level
}
-
${
xyLevel
.
x
}
-
${
xyLevel
.
y
}
`
;
const
heights
=
ApproximateTerrainHeights
.
_terrainHeights
[
key
];
if
(
defined_default
(
heights
))
{
minTerrainHeight
=
heights
[
0
];
maxTerrainHeight
=
heights
[
1
];
}
ellipsoid
.
cartographicToCartesian
(
Rectangle_default
.
northeast
(
rectangle
,
scratchDiagonalCartographic
),
scratchDiagonalCartesianNE
);
ellipsoid
.
cartographicToCartesian
(
Rectangle_default
.
southwest
(
rectangle
,
scratchDiagonalCartographic
),
scratchDiagonalCartesianSW
);
Cartesian3_default
.
midpoint
(
scratchDiagonalCartesianSW
,
scratchDiagonalCartesianNE
,
scratchCenterCartesian
);
const
surfacePosition
=
ellipsoid
.
scaleToGeodeticSurface
(
scratchCenterCartesian
,
scratchSurfaceCartesian
);
if
(
defined_default
(
surfacePosition
))
{
const
distance
=
Cartesian3_default
.
distance
(
scratchCenterCartesian
,
surfacePosition
);
minTerrainHeight
=
Math
.
min
(
minTerrainHeight
,
-
distance
);
}
else
{
minTerrainHeight
=
ApproximateTerrainHeights
.
_defaultMinTerrainHeight
;
}
}
minTerrainHeight
=
Math
.
max
(
ApproximateTerrainHeights
.
_defaultMinTerrainHeight
,
minTerrainHeight
);
return
{
minimumTerrainHeight
:
minTerrainHeight
,
maximumTerrainHeight
:
maxTerrainHeight
};
};
ApproximateTerrainHeights
.
getBoundingSphere
=
function
(
rectangle
,
ellipsoid
)
{
Check_default
.
defined
(
"
rectangle
"
,
rectangle
);
if
(
!
defined_default
(
ApproximateTerrainHeights
.
_terrainHeights
))
{
throw
new
DeveloperError_default
(
"
You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function
"
);
}
ellipsoid
=
defaultValue_default
(
ellipsoid
,
Ellipsoid_default
.
default
);
const
xyLevel
=
getTileXYLevel
(
rectangle
);
let
maxTerrainHeight
=
ApproximateTerrainHeights
.
_defaultMaxTerrainHeight
;
if
(
defined_default
(
xyLevel
))
{
const
key
=
`
${
xyLevel
.
level
}
-
${
xyLevel
.
x
}
-
${
xyLevel
.
y
}
`
;
const
heights
=
ApproximateTerrainHeights
.
_terrainHeights
[
key
];
if
(
defined_default
(
heights
))
{
maxTerrainHeight
=
heights
[
1
];
}
}
const
result
=
BoundingSphere_default
.
fromRectangle3D
(
rectangle
,
ellipsoid
,
0
);
BoundingSphere_default
.
fromRectangle3D
(
rectangle
,
ellipsoid
,
maxTerrainHeight
,
scratchBoundingSphere
);
return
BoundingSphere_default
.
union
(
result
,
scratchBoundingSphere
,
result
);
};
function
getTileXYLevel
(
rectangle
)
{
Cartographic_default
.
fromRadians
(
rectangle
.
east
,
rectangle
.
north
,
0
,
scratchCorners
[
0
]
);
Cartographic_default
.
fromRadians
(
rectangle
.
west
,
rectangle
.
north
,
0
,
scratchCorners
[
1
]
);
Cartographic_default
.
fromRadians
(
rectangle
.
east
,
rectangle
.
south
,
0
,
scratchCorners
[
2
]
);
Cartographic_default
.
fromRadians
(
rectangle
.
west
,
rectangle
.
south
,
0
,
scratchCorners
[
3
]
);
let
lastLevelX
=
0
,
lastLevelY
=
0
;
let
currentX
=
0
,
currentY
=
0
;
const
maxLevel
=
ApproximateTerrainHeights
.
_terrainHeightsMaxLevel
;
let
i
;
for
(
i
=
0
;
i
<=
maxLevel
;
++
i
)
{
let
failed
=
false
;
for
(
let
j
=
0
;
j
<
4
;
++
j
)
{
const
corner
=
scratchCorners
[
j
];
tilingScheme
.
positionToTileXY
(
corner
,
i
,
scratchTileXY
);
if
(
j
===
0
)
{
currentX
=
scratchTileXY
.
x
;
currentY
=
scratchTileXY
.
y
;
}
else
if
(
currentX
!==
scratchTileXY
.
x
||
currentY
!==
scratchTileXY
.
y
)
{
failed
=
true
;
break
;
}
}
if
(
failed
)
{
break
;
}
lastLevelX
=
currentX
;
lastLevelY
=
currentY
;
}
if
(
i
===
0
)
{
return
void
0
;
}
return
{
x
:
lastLevelX
,
y
:
lastLevelY
,
level
:
i
>
maxLevel
?
maxLevel
:
i
-
1
};
}
ApproximateTerrainHeights
.
_terrainHeightsMaxLevel
=
6
;
ApproximateTerrainHeights
.
_defaultMaxTerrainHeight
=
9
e3
;
ApproximateTerrainHeights
.
_defaultMinTerrainHeight
=
-
1
e5
;
ApproximateTerrainHeights
.
_terrainHeights
=
void
0
;
ApproximateTerrainHeights
.
_initPromise
=
void
0
;
Object
.
defineProperties
(
ApproximateTerrainHeights
,
{
/**
* Determines if the terrain heights are initialized and ready to use. To initialize the terrain heights,
* call {@link ApproximateTerrainHeights#initialize} and wait for the returned promise to resolve.
* @type {boolean}
* @readonly
* @memberof ApproximateTerrainHeights
*/
initialized
:
{
get
:
function
()
{
return
defined_default
(
ApproximateTerrainHeights
.
_terrainHeights
);
}
}
});
var
ApproximateTerrainHeights_default
=
ApproximateTerrainHeights
;
// packages/engine/Source/Core/GroundPolylineGeometry.js
var
PROJECTIONS
=
[
GeographicProjection_default
,
WebMercatorProjection_default
];
var
PROJECTION_COUNT
=
PROJECTIONS
.
length
;
var
MITER_BREAK_SMALL
=
Math
.
cos
(
Math_default
.
toRadians
(
30
));
var
MITER_BREAK_LARGE
=
Math
.
cos
(
Math_default
.
toRadians
(
150
));
var
WALL_INITIAL_MIN_HEIGHT
=
0
;
var
WALL_INITIAL_MAX_HEIGHT
=
1
e3
;
function
GroundPolylineGeometry
(
options
)
{
options
=
defaultValue_default
(
options
,
defaultValue_default
.
EMPTY_OBJECT
);
const
positions
=
options
.
positions
;
if
(
!
defined_default
(
positions
)
||
positions
.
length
<
2
)
{
throw
new
DeveloperError_default
(
"
At least two positions are required.
"
);
}
if
(
defined_default
(
options
.
arcType
)
&&
options
.
arcType
!==
ArcType_default
.
GEODESIC
&&
options
.
arcType
!==
ArcType_default
.
RHUMB
)
{
throw
new
DeveloperError_default
(
"
Valid options for arcType are ArcType.GEODESIC and ArcType.RHUMB.
"
);
}
this
.
width
=
defaultValue_default
(
options
.
width
,
1
);
this
.
_positions
=
positions
;
this
.
granularity
=
defaultValue_default
(
options
.
granularity
,
9999
);
this
.
loop
=
defaultValue_default
(
options
.
loop
,
false
);
this
.
arcType
=
defaultValue_default
(
options
.
arcType
,
ArcType_default
.
GEODESIC
);
this
.
_ellipsoid
=
Ellipsoid_default
.
default
;
this
.
_projectionIndex
=
0
;
this
.
_workerName
=
"
createGroundPolylineGeometry
"
;
this
.
_scene3DOnly
=
false
;
}
Object
.
defineProperties
(
GroundPolylineGeometry
.
prototype
,
{
/**
* The number of elements used to pack the object into an array.
* @memberof GroundPolylineGeometry.prototype
* @type {number}
* @readonly
* @private
*/
packedLength
:
{
get
:
function
()
{
return
1
+
this
.
_positions
.
length
*
3
+
1
+
1
+
1
+
Ellipsoid_default
.
packedLength
+
1
+
1
;
}
}
});
GroundPolylineGeometry
.
setProjectionAndEllipsoid
=
function
(
groundPolylineGeometry
,
mapProjection
)
{
let
projectionIndex
=
0
;
for
(
let
i
=
0
;
i
<
PROJECTION_COUNT
;
i
++
)
{
if
(
mapProjection
instanceof
PROJECTIONS
[
i
])
{
projectionIndex
=
i
;
break
;
}
}
groundPolylineGeometry
.
_projectionIndex
=
projectionIndex
;
groundPolylineGeometry
.
_ellipsoid
=
mapProjection
.
ellipsoid
;
};
var
cart3Scratch1
=
new
Cartesian3_default
();
var
cart3Scratch2
=
new
Cartesian3_default
();
var
cart3Scratch3
=
new
Cartesian3_default
();
function
computeRightNormal
(
start
,
end
,
maxHeight
,
ellipsoid
,
result
)
{
const
startBottom
=
getPosition
(
ellipsoid
,
start
,
0
,
cart3Scratch1
);
const
startTop
=
getPosition
(
ellipsoid
,
start
,
maxHeight
,
cart3Scratch2
);
const
endBottom
=
getPosition
(
ellipsoid
,
end
,
0
,
cart3Scratch3
);
const
up
=
direction
(
startTop
,
startBottom
,
cart3Scratch2
);
const
forward
=
direction
(
endBottom
,
startBottom
,
cart3Scratch3
);
Cartesian3_default
.
cross
(
forward
,
up
,
result
);
return
Cartesian3_default
.
normalize
(
result
,
result
);
}
var
interpolatedCartographicScratch
=
new
Cartographic_default
();
var
interpolatedBottomScratch
=
new
Cartesian3_default
();
var
interpolatedTopScratch
=
new
Cartesian3_default
();
var
interpolatedNormalScratch
=
new
Cartesian3_default
();
function
interpolateSegment
(
start
,
end
,
minHeight
,
maxHeight
,
granularity
,
arcType
,
ellipsoid
,
normalsArray
,
bottomPositionsArray
,
topPositionsArray
,
cartographicsArray
)
{
if
(
granularity
===
0
)
{
return
;
}
let
ellipsoidLine
;
if
(
arcType
===
ArcType_default
.
GEODESIC
)
{
ellipsoidLine
=
new
EllipsoidGeodesic_default
(
start
,
end
,
ellipsoid
);
}
else
if
(
arcType
===
ArcType_default
.
RHUMB
)
{
ellipsoidLine
=
new
EllipsoidRhumbLine_default
(
start
,
end
,
ellipsoid
);
}
const
surfaceDistance
=
ellipsoidLine
.
surfaceDistance
;
if
(
surfaceDistance
<
granularity
)
{
return
;
}
const
interpolatedNormal
=
computeRightNormal
(
start
,
end
,
maxHeight
,
ellipsoid
,
interpolatedNormalScratch
);
const
segments
=
Math
.
ceil
(
surfaceDistance
/
granularity
);
const
interpointDistance
=
surfaceDistance
/
segments
;
let
distanceFromStart
=
interpointDistance
;
const
pointsToAdd
=
segments
-
1
;
let
packIndex
=
normalsArray
.
length
;
for
(
let
i
=
0
;
i
<
pointsToAdd
;
i
++
)
{
const
interpolatedCartographic
=
ellipsoidLine
.
interpolateUsingSurfaceDistance
(
distanceFromStart
,
interpolatedCartographicScratch
);
const
interpolatedBottom
=
getPosition
(
ellipsoid
,
interpolatedCartographic
,
minHeight
,
interpolatedBottomScratch
);
const
interpolatedTop
=
getPosition
(
ellipsoid
,
interpolatedCartographic
,
maxHeight
,
interpolatedTopScratch
);
Cartesian3_default
.
pack
(
interpolatedNormal
,
normalsArray
,
packIndex
);
Cartesian3_default
.
pack
(
interpolatedBottom
,
bottomPositionsArray
,
packIndex
);
Cartesian3_default
.
pack
(
interpolatedTop
,
topPositionsArray
,
packIndex
);
cartographicsArray
.
push
(
interpolatedCartographic
.
latitude
);
cartographicsArray
.
push
(
interpolatedCartographic
.
longitude
);
packIndex
+=
3
;
distanceFromStart
+=
interpointDistance
;
}
}
var
heightlessCartographicScratch
=
new
Cartographic_default
();
function
getPosition
(
ellipsoid
,
cartographic
,
height
,
result
)
{
Cartographic_default
.
clone
(
cartographic
,
heightlessCartographicScratch
);
heightlessCartographicScratch
.
height
=
height
;
return
Cartographic_default
.
toCartesian
(
heightlessCartographicScratch
,
ellipsoid
,
result
);
}
GroundPolylineGeometry
.
pack
=
function
(
value
,
array
,
startingIndex
)
{
Check_default
.
typeOf
.
object
(
"
value
"
,
value
);
Check_default
.
defined
(
"
array
"
,
array
);
let
index
=
defaultValue_default
(
startingIndex
,
0
);
const
positions
=
value
.
_positions
;
const
positionsLength
=
positions
.
length
;
array
[
index
++
]
=
positionsLength
;
for
(
let
i
=
0
;
i
<
positionsLength
;
++
i
)
{
const
cartesian
=
positions
[
i
];
Cartesian3_default
.
pack
(
cartesian
,
array
,
index
);
index
+=
3
;
}
array
[
index
++
]
=
value
.
granularity
;
array
[
index
++
]
=
value
.
loop
?
1
:
0
;
array
[
index
++
]
=
value
.
arcType
;
Ellipsoid_default
.
pack
(
value
.
_ellipsoid
,
array
,
index
);
index
+=
Ellipsoid_default
.
packedLength
;
array
[
index
++
]
=
value
.
_projectionIndex
;
array
[
index
++
]
=
value
.
_scene3DOnly
?
1
:
0
;
return
array
;
};
GroundPolylineGeometry
.
unpack
=
function
(
array
,
startingIndex
,
result
)
{
Check_default
.
defined
(
"
array
"
,
array
);
let
index
=
defaultValue_default
(
startingIndex
,
0
);
const
positionsLength
=
array
[
index
++
];
const
positions
=
new
Array
(
positionsLength
);
for
(
let
i
=
0
;
i
<
positionsLength
;
i
++
)
{
positions
[
i
]
=
Cartesian3_default
.
unpack
(
array
,
index
);
index
+=
3
;
}
const
granularity
=
array
[
index
++
];
const
loop
=
array
[
index
++
]
===
1
;
const
arcType
=
array
[
index
++
];
const
ellipsoid
=
Ellipsoid_default
.
unpack
(
array
,
index
);
index
+=
Ellipsoid_default
.
packedLength
;
const
projectionIndex
=
array
[
index
++
];
const
scene3DOnly
=
array
[
index
++
]
===
1
;
if
(
!
defined_default
(
result
))
{
result
=
new
GroundPolylineGeometry
({
positions
});
}
result
.
_positions
=
positions
;
result
.
granularity
=
granularity
;
result
.
loop
=
loop
;
result
.
arcType
=
arcType
;
result
.
_ellipsoid
=
ellipsoid
;
result
.
_projectionIndex
=
projectionIndex
;
result
.
_scene3DOnly
=
scene3DOnly
;
return
result
;
};
function
direction
(
target
,
origin
,
result
)
{
Cartesian3_default
.
subtract
(
target
,
origin
,
result
);
Cartesian3_default
.
normalize
(
result
,
result
);
return
result
;
}
function
tangentDirection
(
target
,
origin
,
up
,
result
)
{
result
=
direction
(
target
,
origin
,
result
);
result
=
Cartesian3_default
.
cross
(
result
,
up
,
result
);
result
=
Cartesian3_default
.
normalize
(
result
,
result
);
result
=
Cartesian3_default
.
cross
(
up
,
result
,
result
);
return
result
;
}
var
toPreviousScratch
=
new
Cartesian3_default
();
var
toNextScratch
=
new
Cartesian3_default
();
var
forwardScratch
=
new
Cartesian3_default
();
var
vertexUpScratch
=
new
Cartesian3_default
();
var
cosine90
=
0
;
var
cosine180
=
-
1
;
function
computeVertexMiterNormal
(
previousBottom
,
vertexBottom
,
vertexTop
,
nextBottom
,
result
)
{
const
up
=
direction
(
vertexTop
,
vertexBottom
,
vertexUpScratch
);
const
toPrevious
=
tangentDirection
(
previousBottom
,
vertexBottom
,
up
,
toPreviousScratch
);
const
toNext
=
tangentDirection
(
nextBottom
,
vertexBottom
,
up
,
toNextScratch
);
if
(
Math_default
.
equalsEpsilon
(
Cartesian3_default
.
dot
(
toPrevious
,
toNext
),
cosine180
,
Math_default
.
EPSILON5
))
{
result
=
Cartesian3_default
.
cross
(
up
,
toPrevious
,
result
);
result
=
Cartesian3_default
.
normalize
(
result
,
result
);
return
result
;
}
result
=
Cartesian3_default
.
add
(
toNext
,
toPrevious
,
result
);
result
=
Cartesian3_default
.
normalize
(
result
,
result
);
const
forward
=
Cartesian3_default
.
cross
(
up
,
result
,
forwardScratch
);
if
(
Cartesian3_default
.
dot
(
toNext
,
forward
)
<
cosine90
)
{
result
=
Cartesian3_default
.
negate
(
result
,
result
);
}
return
result
;
}
var
XZ_PLANE
=
Plane_default
.
fromPointNormal
(
Cartesian3_default
.
ZERO
,
Cartesian3_default
.
UNIT_Y
);
var
previousBottomScratch
=
new
Cartesian3_default
();
var
vertexBottomScratch
=
new
Cartesian3_default
();
var
vertexTopScratch
=
new
Cartesian3_default
();
var
nextBottomScratch
=
new
Cartesian3_default
();
var
vertexNormalScratch
=
new
Cartesian3_default
();
var
intersectionScratch
=
new
Cartesian3_default
();
var
cartographicScratch0
=
new
Cartographic_default
();
var
cartographicScratch1
=
new
Cartographic_default
();
var
cartographicIntersectionScratch
=
new
Cartographic_default
();
GroundPolylineGeometry
.
createGeometry
=
function
(
groundPolylineGeometry
)
{
const
compute2dAttributes
=
!
groundPolylineGeometry
.
_scene3DOnly
;
let
loop
=
groundPolylineGeometry
.
loop
;
const
ellipsoid
=
groundPolylineGeometry
.
_ellipsoid
;
const
granularity
=
groundPolylineGeometry
.
granularity
;
const
arcType
=
groundPolylineGeometry
.
arcType
;
const
projection
=
new
PROJECTIONS
[
groundPolylineGeometry
.
_projectionIndex
](
ellipsoid
);
const
minHeight
=
WALL_INITIAL_MIN_HEIGHT
;
const
maxHeight
=
WALL_INITIAL_MAX_HEIGHT
;
let
index
;
let
i
;
const
positions
=
groundPolylineGeometry
.
_positions
;
const
positionsLength
=
positions
.
length
;
if
(
positionsLength
===
2
)
{
loop
=
false
;
}
let
p0
;
let
p1
;
let
c0
;
let
c1
;
const
rhumbLine
=
new
EllipsoidRhumbLine_default
(
void
0
,
void
0
,
ellipsoid
);
let
intersection
;
let
intersectionCartographic
;
let
intersectionLongitude
;
const
splitPositions
=
[
positions
[
0
]];
for
(
i
=
0
;
i
<
positionsLength
-
1
;
i
++
)
{
p0
=
positions
[
i
];
p1
=
positions
[
i
+
1
];
intersection
=
IntersectionTests_default
.
lineSegmentPlane
(
p0
,
p1
,
XZ_PLANE
,
intersectionScratch
);
if
(
defined_default
(
intersection
)
&&
!
Cartesian3_default
.
equalsEpsilon
(
intersection
,
p0
,
Math_default
.
EPSILON7
)
&&
!
Cartesian3_default
.
equalsEpsilon
(
intersection
,
p1
,
Math_default
.
EPSILON7
))
{
if
(
groundPolylineGeometry
.
arcType
===
ArcType_default
.
GEODESIC
)
{
splitPositions
.
push
(
Cartesian3_default
.
clone
(
intersection
));
}
else
if
(
groundPolylineGeometry
.
arcType
===
ArcType_default
.
RHUMB
)
{
intersectionLongitude
=
ellipsoid
.
cartesianToCartographic
(
intersection
,
cartographicScratch0
).
longitude
;
c0
=
ellipsoid
.
cartesianToCartographic
(
p0
,
cartographicScratch0
);
c1
=
ellipsoid
.
cartesianToCartographic
(
p1
,
cartographicScratch1
);
rhumbLine
.
setEndPoints
(
c0
,
c1
);
intersectionCartographic
=
rhumbLine
.
findIntersectionWithLongitude
(
intersectionLongitude
,
cartographicIntersectionScratch
);
intersection
=
ellipsoid
.
cartographicToCartesian
(
intersectionCartographic
,
intersectionScratch
);
if
(
defined_default
(
intersection
)
&&
!
Cartesian3_default
.
equalsEpsilon
(
intersection
,
p0
,
Math_default
.
EPSILON7
)
&&
!
Cartesian3_default
.
equalsEpsilon
(
intersection
,
p1
,
Math_default
.
EPSILON7
))
{
splitPositions
.
push
(
Cartesian3_default
.
clone
(
intersection
));
}
}
}
splitPositions
.
push
(
p1
);
}
if
(
loop
)
{
p0
=
positions
[
positionsLength
-
1
];
p1
=
positions
[
0
];
intersection
=
IntersectionTests_default
.
lineSegmentPlane
(
p0
,
p1
,
XZ_PLANE
,
intersectionScratch
);
if
(
defined_default
(
intersection
)
&&
!
Cartesian3_default
.
equalsEpsilon
(
intersection
,
p0
,
Math_default
.
EPSILON7
)
&&
!
Cartesian3_default
.
equalsEpsilon
(
intersection
,
p1
,
Math_default
.
EPSILON7
))
{
if
(
groundPolylineGeometry
.
arcType
===
ArcType_default
.
GEODESIC
)
{
splitPositions
.
push
(
Cartesian3_default
.
clone
(
intersection
));
}
else
if
(
groundPolylineGeometry
.
arcType
===
ArcType_default
.
RHUMB
)
{
intersectionLongitude
=
ellipsoid
.
cartesianToCartographic
(
intersection
,
cartographicScratch0
).
longitude
;
c0
=
ellipsoid
.
cartesianToCartographic
(
p0
,
cartographicScratch0
);
c1
=
ellipsoid
.
cartesianToCartographic
(
p1
,
cartographicScratch1
);
rhumbLine
.
setEndPoints
(
c0
,
c1
);
intersectionCartographic
=
rhumbLine
.
findIntersectionWithLongitude
(
intersectionLongitude
,
cartographicIntersectionScratch
);
intersection
=
ellipsoid
.
cartographicToCartesian
(
intersectionCartographic
,
intersectionScratch
);
if
(
defined_default
(
intersection
)
&&
!
Cartesian3_default
.
equalsEpsilon
(
intersection
,
p0
,
Math_default
.
EPSILON7
)
&&
!
Cartesian3_default
.
equalsEpsilon
(
intersection
,
p1
,
Math_default
.
EPSILON7
))
{
splitPositions
.
push
(
Cartesian3_default
.
clone
(
intersection
));
}
}
}
}
let
cartographicsLength
=
splitPositions
.
length
;
let
cartographics
=
new
Array
(
cartographicsLength
);
for
(
i
=
0
;
i
<
cartographicsLength
;
i
++
)
{
const
cartographic
=
Cartographic_default
.
fromCartesian
(
splitPositions
[
i
],
ellipsoid
);
cartographic
.
height
=
0
;
cartographics
[
i
]
=
cartographic
;
}
cartographics
=
arrayRemoveDuplicates_default
(
cartographics
,
Cartographic_default
.
equalsEpsilon
);
cartographicsLength
=
cartographics
.
length
;
if
(
cartographicsLength
<
2
)
{
return
void
0
;
}
const
cartographicsArray
=
[];
const
normalsArray
=
[];
const
bottomPositionsArray
=
[];
const
topPositionsArray
=
[];
let
previousBottom
=
previousBottomScratch
;
let
vertexBottom
=
vertexBottomScratch
;
let
vertexTop
=
vertexTopScratch
;
let
nextBottom
=
nextBottomScratch
;
let
vertexNormal
=
vertexNormalScratch
;
const
startCartographic
=
cartographics
[
0
];
const
nextCartographic
=
cartographics
[
1
];
const
prestartCartographic
=
cartographics
[
cartographicsLength
-
1
];
previousBottom
=
getPosition
(
ellipsoid
,
prestartCartographic
,
minHeight
,
previousBottom
);
nextBottom
=
getPosition
(
ellipsoid
,
nextCartographic
,
minHeight
,
nextBottom
);
vertexBottom
=
getPosition
(
ellipsoid
,
startCartographic
,
minHeight
,
vertexBottom
);
vertexTop
=
getPosition
(
ellipsoid
,
startCartographic
,
maxHeight
,
vertexTop
);
if
(
loop
)
{
vertexNormal
=
computeVertexMiterNormal
(
previousBottom
,
vertexBottom
,
vertexTop
,
nextBottom
,
vertexNormal
);
}
else
{
vertexNormal
=
computeRightNormal
(
startCartographic
,
nextCartographic
,
maxHeight
,
ellipsoid
,
vertexNormal
);
}
Cartesian3_default
.
pack
(
vertexNormal
,
normalsArray
,
0
);
Cartesian3_default
.
pack
(
vertexBottom
,
bottomPositionsArray
,
0
);
Cartesian3_default
.
pack
(
vertexTop
,
topPositionsArray
,
0
);
cartographicsArray
.
push
(
startCartographic
.
latitude
);
cartographicsArray
.
push
(
startCartographic
.
longitude
);
interpolateSegment
(
startCartographic
,
nextCartographic
,
minHeight
,
maxHeight
,
granularity
,
arcType
,
ellipsoid
,
normalsArray
,
bottomPositionsArray
,
topPositionsArray
,
cartographicsArray
);
for
(
i
=
1
;
i
<
cartographicsLength
-
1
;
++
i
)
{
previousBottom
=
Cartesian3_default
.
clone
(
vertexBottom
,
previousBottom
);
vertexBottom
=
Cartesian3_default
.
clone
(
nextBottom
,
vertexBottom
);
const
vertexCartographic
=
cartographics
[
i
];
getPosition
(
ellipsoid
,
vertexCartographic
,
maxHeight
,
vertexTop
);
getPosition
(
ellipsoid
,
cartographics
[
i
+
1
],
minHeight
,
nextBottom
);
computeVertexMiterNormal
(
previousBottom
,
vertexBottom
,
vertexTop
,
nextBottom
,
vertexNormal
);
index
=
normalsArray
.
length
;
Cartesian3_default
.
pack
(
vertexNormal
,
normalsArray
,
index
);
Cartesian3_default
.
pack
(
vertexBottom
,
bottomPositionsArray
,
index
);
Cartesian3_default
.
pack
(
vertexTop
,
topPositionsArray
,
index
);
cartographicsArray
.
push
(
vertexCartographic
.
latitude
);
cartographicsArray
.
push
(
vertexCartographic
.
longitude
);
interpolateSegment
(
cartographics
[
i
],
cartographics
[
i
+
1
],
minHeight
,
maxHeight
,
granularity
,
arcType
,
ellipsoid
,
normalsArray
,
bottomPositionsArray
,
topPositionsArray
,
cartographicsArray
);
}
const
endCartographic
=
cartographics
[
cartographicsLength
-
1
];
const
preEndCartographic
=
cartographics
[
cartographicsLength
-
2
];
vertexBottom
=
getPosition
(
ellipsoid
,
endCartographic
,
minHeight
,
vertexBottom
);
vertexTop
=
getPosition
(
ellipsoid
,
endCartographic
,
maxHeight
,
vertexTop
);
if
(
loop
)
{
const
postEndCartographic
=
cartographics
[
0
];
previousBottom
=
getPosition
(
ellipsoid
,
preEndCartographic
,
minHeight
,
previousBottom
);
nextBottom
=
getPosition
(
ellipsoid
,
postEndCartographic
,
minHeight
,
nextBottom
);
vertexNormal
=
computeVertexMiterNormal
(
previousBottom
,
vertexBottom
,
vertexTop
,
nextBottom
,
vertexNormal
);
}
else
{
vertexNormal
=
computeRightNormal
(
preEndCartographic
,
endCartographic
,
maxHeight
,
ellipsoid
,
vertexNormal
);
}
index
=
normalsArray
.
length
;
Cartesian3_default
.
pack
(
vertexNormal
,
normalsArray
,
index
);
Cartesian3_default
.
pack
(
vertexBottom
,
bottomPositionsArray
,
index
);
Cartesian3_default
.
pack
(
vertexTop
,
topPositionsArray
,
index
);
cartographicsArray
.
push
(
endCartographic
.
latitude
);
cartographicsArray
.
push
(
endCartographic
.
longitude
);
if
(
loop
)
{
interpolateSegment
(
endCartographic
,
startCartographic
,
minHeight
,
maxHeight
,
granularity
,
arcType
,
ellipsoid
,
normalsArray
,
bottomPositionsArray
,
topPositionsArray
,
cartographicsArray
);
index
=
normalsArray
.
length
;
for
(
i
=
0
;
i
<
3
;
++
i
)
{
normalsArray
[
index
+
i
]
=
normalsArray
[
i
];
bottomPositionsArray
[
index
+
i
]
=
bottomPositionsArray
[
i
];
topPositionsArray
[
index
+
i
]
=
topPositionsArray
[
i
];
}
cartographicsArray
.
push
(
startCartographic
.
latitude
);
cartographicsArray
.
push
(
startCartographic
.
longitude
);
}
return
generateGeometryAttributes
(
loop
,
projection
,
bottomPositionsArray
,
topPositionsArray
,
normalsArray
,
cartographicsArray
,
compute2dAttributes
);
};
var
lineDirectionScratch
=
new
Cartesian3_default
();
var
matrix3Scratch
=
new
Matrix3_default
();
var
quaternionScratch
=
new
Quaternion_default
();
function
breakMiter
(
endGeometryNormal
,
startBottom
,
endBottom
,
endTop
)
{
const
lineDirection
=
direction
(
endBottom
,
startBottom
,
lineDirectionScratch
);
const
dot
=
Cartesian3_default
.
dot
(
lineDirection
,
endGeometryNormal
);
if
(
dot
>
MITER_BREAK_SMALL
||
dot
<
MITER_BREAK_LARGE
)
{
const
vertexUp
=
direction
(
endTop
,
endBottom
,
vertexUpScratch
);
const
angle
=
dot
<
MITER_BREAK_LARGE
?
Math_default
.
PI_OVER_TWO
:
-
Math_default
.
PI_OVER_TWO
;
const
quaternion
=
Quaternion_default
.
fromAxisAngle
(
vertexUp
,
angle
,
quaternionScratch
);
const
rotationMatrix
=
Matrix3_default
.
fromQuaternion
(
quaternion
,
matrix3Scratch
);
Matrix3_default
.
multiplyByVector
(
rotationMatrix
,
endGeometryNormal
,
endGeometryNormal
);
return
true
;
}
return
false
;
}
var
endPosCartographicScratch
=
new
Cartographic_default
();
var
normalStartpointScratch
=
new
Cartesian3_default
();
var
normalEndpointScratch
=
new
Cartesian3_default
();
function
projectNormal
(
projection
,
cartographic
,
normal
,
projectedPosition
,
result
)
{
const
position
=
Cartographic_default
.
toCartesian
(
cartographic
,
projection
.
_ellipsoid
,
normalStartpointScratch
);
let
normalEndpoint
=
Cartesian3_default
.
add
(
position
,
normal
,
normalEndpointScratch
);
let
flipNormal
=
false
;
const
ellipsoid
=
projection
.
_ellipsoid
;
let
normalEndpointCartographic
=
ellipsoid
.
cartesianToCartographic
(
normalEndpoint
,
endPosCartographicScratch
);
if
(
Math
.
abs
(
cartographic
.
longitude
-
normalEndpointCartographic
.
longitude
)
>
Math_default
.
PI_OVER_TWO
)
{
flipNormal
=
true
;
normalEndpoint
=
Cartesian3_default
.
subtract
(
position
,
normal
,
normalEndpointScratch
);
normalEndpointCartographic
=
ellipsoid
.
cartesianToCartographic
(
normalEndpoint
,
endPosCartographicScratch
);
}
normalEndpointCartographic
.
height
=
0
;
const
normalEndpointProjected
=
projection
.
project
(
normalEndpointCartographic
,
result
);
result
=
Cartesian3_default
.
subtract
(
normalEndpointProjected
,
projectedPosition
,
result
);
result
.
z
=
0
;
result
=
Cartesian3_default
.
normalize
(
result
,
result
);
if
(
flipNormal
)
{
Cartesian3_default
.
negate
(
result
,
result
);
}
return
result
;
}
var
adjustHeightNormalScratch
=
new
Cartesian3_default
();
var
adjustHeightOffsetScratch
=
new
Cartesian3_default
();
function
adjustHeights
(
bottom
,
top
,
minHeight
,
maxHeight
,
adjustHeightBottom
,
adjustHeightTop
)
{
const
adjustHeightNormal
=
Cartesian3_default
.
subtract
(
top
,
bottom
,
adjustHeightNormalScratch
);
Cartesian3_default
.
normalize
(
adjustHeightNormal
,
adjustHeightNormal
);
const
distanceForBottom
=
minHeight
-
WALL_INITIAL_MIN_HEIGHT
;
let
adjustHeightOffset
=
Cartesian3_default
.
multiplyByScalar
(
adjustHeightNormal
,
distanceForBottom
,
adjustHeightOffsetScratch
);
Cartesian3_default
.
add
(
bottom
,
adjustHeightOffset
,
adjustHeightBottom
);
const
distanceForTop
=
maxHeight
-
WALL_INITIAL_MAX_HEIGHT
;
adjustHeightOffset
=
Cartesian3_default
.
multiplyByScalar
(
adjustHeightNormal
,
distanceForTop
,
adjustHeightOffsetScratch
);
Cartesian3_default
.
add
(
top
,
adjustHeightOffset
,
adjustHeightTop
);
}
var
nudgeDirectionScratch
=
new
Cartesian3_default
();
function
nudgeXZ
(
start
,
end
)
{
const
startToXZdistance
=
Plane_default
.
getPointDistance
(
XZ_PLANE
,
start
);
const
endToXZdistance
=
Plane_default
.
getPointDistance
(
XZ_PLANE
,
end
);
let
offset
=
nudgeDirectionScratch
;
if
(
Math_default
.
equalsEpsilon
(
startToXZdistance
,
0
,
Math_default
.
EPSILON2
))
{
offset
=
direction
(
end
,
start
,
offset
);
Cartesian3_default
.
multiplyByScalar
(
offset
,
Math_default
.
EPSILON2
,
offset
);
Cartesian3_default
.
add
(
start
,
offset
,
start
);
}
else
if
(
Math_default
.
equalsEpsilon
(
endToXZdistance
,
0
,
Math_default
.
EPSILON2
))
{
offset
=
direction
(
start
,
end
,
offset
);
Cartesian3_default
.
multiplyByScalar
(
offset
,
Math_default
.
EPSILON2
,
offset
);
Cartesian3_default
.
add
(
end
,
offset
,
end
);
}
}
function
nudgeCartographic
(
start
,
end
)
{
const
absStartLon
=
Math
.
abs
(
start
.
longitude
);
const
absEndLon
=
Math
.
abs
(
end
.
longitude
);
if
(
Math_default
.
equalsEpsilon
(
absStartLon
,
Math_default
.
PI
,
Math_default
.
EPSILON11
))
{
const
endSign
=
Math_default
.
sign
(
end
.
longitude
);
start
.
longitude
=
endSign
*
(
absStartLon
-
Math_default
.
EPSILON11
);
return
1
;
}
else
if
(
Math_default
.
equalsEpsilon
(
absEndLon
,
Math_default
.
PI
,
Math_default
.
EPSILON11
))
{
const
startSign
=
Math_default
.
sign
(
start
.
longitude
);
end
.
longitude
=
startSign
*
(
absEndLon
-
Math_default
.
EPSILON11
);
return
2
;
}
return
0
;
}
var
startCartographicScratch
=
new
Cartographic_default
();
var
endCartographicScratch
=
new
Cartographic_default
();
var
segmentStartTopScratch
=
new
Cartesian3_default
();
var
segmentEndTopScratch
=
new
Cartesian3_default
();
var
segmentStartBottomScratch
=
new
Cartesian3_default
();
var
segmentEndBottomScratch
=
new
Cartesian3_default
();
var
segmentStartNormalScratch
=
new
Cartesian3_default
();
var
segmentEndNormalScratch
=
new
Cartesian3_default
();
var
getHeightCartographics
=
[
startCartographicScratch
,
endCartographicScratch
];
var
getHeightRectangleScratch
=
new
Rectangle_default
();
var
adjustHeightStartTopScratch
=
new
Cartesian3_default
();
var
adjustHeightEndTopScratch
=
new
Cartesian3_default
();
var
adjustHeightStartBottomScratch
=
new
Cartesian3_default
();
var
adjustHeightEndBottomScratch
=
new
Cartesian3_default
();
var
segmentStart2DScratch
=
new
Cartesian3_default
();
var
segmentEnd2DScratch
=
new
Cartesian3_default
();
var
segmentStartNormal2DScratch
=
new
Cartesian3_default
();
var
segmentEndNormal2DScratch
=
new
Cartesian3_default
();
var
offsetScratch
=
new
Cartesian3_default
();
var
startUpScratch
=
new
Cartesian3_default
();
var
endUpScratch
=
new
Cartesian3_default
();
var
rightScratch
=
new
Cartesian3_default
();
var
startPlaneNormalScratch
=
new
Cartesian3_default
();
var
endPlaneNormalScratch
=
new
Cartesian3_default
();
var
encodeScratch
=
new
EncodedCartesian3_default
();
var
encodeScratch2D
=
new
EncodedCartesian3_default
();
var
forwardOffset2DScratch
=
new
Cartesian3_default
();
var
right2DScratch
=
new
Cartesian3_default
();
var
normalNudgeScratch
=
new
Cartesian3_default
();
var
scratchBoundingSpheres
=
[
new
BoundingSphere_default
(),
new
BoundingSphere_default
()];
var
REFERENCE_INDICES
=
[
0
,
2
,
1
,
0
,
3
,
2
,
// right
0
,
7
,
3
,
0
,
4
,
7
,
// start
0
,
5
,
4
,
0
,
1
,
5
,
// bottom
5
,
7
,
4
,
5
,
6
,
7
,
// left
5
,
2
,
6
,
5
,
1
,
2
,
// end
3
,
6
,
2
,
3
,
7
,
6
// top
];
var
REFERENCE_INDICES_LENGTH
=
REFERENCE_INDICES
.
length
;
function
generateGeometryAttributes
(
loop
,
projection
,
bottomPositionsArray
,
topPositionsArray
,
normalsArray
,
cartographicsArray
,
compute2dAttributes
)
{
let
i
;
let
index
;
const
ellipsoid
=
projection
.
_ellipsoid
;
const
segmentCount
=
bottomPositionsArray
.
length
/
3
-
1
;
const
vertexCount
=
segmentCount
*
8
;
const
arraySizeVec4
=
vertexCount
*
4
;
const
indexCount
=
segmentCount
*
36
;
const
indices
=
vertexCount
>
65535
?
new
Uint32Array
(
indexCount
)
:
new
Uint16Array
(
indexCount
);
const
positionsArray
=
new
Float64Array
(
vertexCount
*
3
);
const
startHiAndForwardOffsetX
=
new
Float32Array
(
arraySizeVec4
);
const
startLoAndForwardOffsetY
=
new
Float32Array
(
arraySizeVec4
);
const
startNormalAndForwardOffsetZ
=
new
Float32Array
(
arraySizeVec4
);
const
endNormalAndTextureCoordinateNormalizationX
=
new
Float32Array
(
arraySizeVec4
);
const
rightNormalAndTextureCoordinateNormalizationY
=
new
Float32Array
(
arraySizeVec4
);
let
startHiLo2D
;
let
offsetAndRight2D
;
let
startEndNormals2D
;
let
texcoordNormalization2D
;
if
(
compute2dAttributes
)
{
startHiLo2D
=
new
Float32Array
(
arraySizeVec4
);
offsetAndRight2D
=
new
Float32Array
(
arraySizeVec4
);
startEndNormals2D
=
new
Float32Array
(
arraySizeVec4
);
texcoordNormalization2D
=
new
Float32Array
(
vertexCount
*
2
);
}
const
cartographicsLength
=
cartographicsArray
.
length
/
2
;
let
length2D
=
0
;
const
startCartographic
=
startCartographicScratch
;
startCartographic
.
height
=
0
;
const
endCartographic
=
endCartographicScratch
;
endCartographic
.
height
=
0
;
let
segmentStartCartesian
=
segmentStartTopScratch
;
let
segmentEndCartesian
=
segmentEndTopScratch
;
if
(
compute2dAttributes
)
{
index
=
0
;
for
(
i
=
1
;
i
<
cartographicsLength
;
i
++
)
{
startCartographic
.
latitude
=
cartographicsArray
[
index
];
startCartographic
.
longitude
=
cartographicsArray
[
index
+
1
];
endCartographic
.
latitude
=
cartographicsArray
[
index
+
2
];
endCartographic
.
longitude
=
cartographicsArray
[
index
+
3
];
segmentStartCartesian
=
projection
.
project
(
startCartographic
,
segmentStartCartesian
);
segmentEndCartesian
=
projection
.
project
(
endCartographic
,
segmentEndCartesian
);
length2D
+=
Cartesian3_default
.
distance
(
segmentStartCartesian
,
segmentEndCartesian
);
index
+=
2
;
}
}
const
positionsLength
=
topPositionsArray
.
length
/
3
;
segmentEndCartesian
=
Cartesian3_default
.
unpack
(
topPositionsArray
,
0
,
segmentEndCartesian
);
let
length3D
=
0
;
index
=
3
;
for
(
i
=
1
;
i
<
positionsLength
;
i
++
)
{
segmentStartCartesian
=
Cartesian3_default
.
clone
(
segmentEndCartesian
,
segmentStartCartesian
);
segmentEndCartesian
=
Cartesian3_default
.
unpack
(
topPositionsArray
,
index
,
segmentEndCartesian
);
length3D
+=
Cartesian3_default
.
distance
(
segmentStartCartesian
,
segmentEndCartesian
);
index
+=
3
;
}
let
j
;
index
=
3
;
let
cartographicsIndex
=
0
;
let
vec2sWriteIndex
=
0
;
let
vec3sWriteIndex
=
0
;
let
vec4sWriteIndex
=
0
;
let
miterBroken
=
false
;
let
endBottom
=
Cartesian3_default
.
unpack
(
bottomPositionsArray
,
0
,
segmentEndBottomScratch
);
let
endTop
=
Cartesian3_default
.
unpack
(
topPositionsArray
,
0
,
segmentEndTopScratch
);
let
endGeometryNormal
=
Cartesian3_default
.
unpack
(
normalsArray
,
0
,
segmentEndNormalScratch
);
if
(
loop
)
{
const
preEndBottom
=
Cartesian3_default
.
unpack
(
bottomPositionsArray
,
bottomPositionsArray
.
length
-
6
,
segmentStartBottomScratch
);
if
(
breakMiter
(
endGeometryNormal
,
preEndBottom
,
endBottom
,
endTop
))
{
endGeometryNormal
=
Cartesian3_default
.
negate
(
endGeometryNormal
,
endGeometryNormal
);
}
}
let
lengthSoFar3D
=
0
;
let
lengthSoFar2D
=
0
;
let
sumHeights
=
0
;
for
(
i
=
0
;
i
<
segmentCount
;
i
++
)
{
const
startBottom
=
Cartesian3_default
.
clone
(
endBottom
,
segmentStartBottomScratch
);
const
startTop
=
Cartesian3_default
.
clone
(
endTop
,
segmentStartTopScratch
);
let
startGeometryNormal
=
Cartesian3_default
.
clone
(
endGeometryNormal
,
segmentStartNormalScratch
);
if
(
miterBroken
)
{
startGeometryNormal
=
Cartesian3_default
.
negate
(
startGeometryNormal
,
startGeometryNormal
);
}
endBottom
=
Cartesian3_default
.
unpack
(
bottomPositionsArray
,
index
,
segmentEndBottomScratch
);
endTop
=
Cartesian3_default
.
unpack
(
topPositionsArray
,
index
,
segmentEndTopScratch
);
endGeometryNormal
=
Cartesian3_default
.
unpack
(
normalsArray
,
index
,
segmentEndNormalScratch
);
miterBroken
=
breakMiter
(
endGeometryNormal
,
startBottom
,
endBottom
,
endTop
);
startCartographic
.
latitude
=
cartographicsArray
[
cartographicsIndex
];
startCartographic
.
longitude
=
cartographicsArray
[
cartographicsIndex
+
1
];
endCartographic
.
latitude
=
cartographicsArray
[
cartographicsIndex
+
2
];
endCartographic
.
longitude
=
cartographicsArray
[
cartographicsIndex
+
3
];
let
start2D
;
let
end2D
;
let
startGeometryNormal2D
;
let
endGeometryNormal2D
;
if
(
compute2dAttributes
)
{
const
nudgeResult
=
nudgeCartographic
(
startCartographic
,
endCartographic
);
start2D
=
projection
.
project
(
startCartographic
,
segmentStart2DScratch
);
end2D
=
projection
.
project
(
endCartographic
,
segmentEnd2DScratch
);
const
direction2D
=
direction
(
end2D
,
start2D
,
forwardOffset2DScratch
);
direction2D
.
y
=
Math
.
abs
(
direction2D
.
y
);
startGeometryNormal2D
=
segmentStartNormal2DScratch
;
endGeometryNormal2D
=
segmentEndNormal2DScratch
;
if
(
nudgeResult
===
0
||
Cartesian3_default
.
dot
(
direction2D
,
Cartesian3_default
.
UNIT_Y
)
>
MITER_BREAK_SMALL
)
{
startGeometryNormal2D
=
projectNormal
(
projection
,
startCartographic
,
startGeometryNormal
,
start2D
,
segmentStartNormal2DScratch
);
endGeometryNormal2D
=
projectNormal
(
projection
,
endCartographic
,
endGeometryNormal
,
end2D
,
segmentEndNormal2DScratch
);
}
else
if
(
nudgeResult
===
1
)
{
endGeometryNormal2D
=
projectNormal
(
projection
,
endCartographic
,
endGeometryNormal
,
end2D
,
segmentEndNormal2DScratch
);
startGeometryNormal2D
.
x
=
0
;
startGeometryNormal2D
.
y
=
Math_default
.
sign
(
startCartographic
.
longitude
-
Math
.
abs
(
endCartographic
.
longitude
)
);
startGeometryNormal2D
.
z
=
0
;
}
else
{
startGeometryNormal2D
=
projectNormal
(
projection
,
startCartographic
,
startGeometryNormal
,
start2D
,
segmentStartNormal2DScratch
);
endGeometryNormal2D
.
x
=
0
;
endGeometryNormal2D
.
y
=
Math_default
.
sign
(
startCartographic
.
longitude
-
endCartographic
.
longitude
);
endGeometryNormal2D
.
z
=
0
;
}
}
const
segmentLength3D
=
Cartesian3_default
.
distance
(
startTop
,
endTop
);
const
encodedStart
=
EncodedCartesian3_default
.
fromCartesian
(
startBottom
,
encodeScratch
);
const
forwardOffset
=
Cartesian3_default
.
subtract
(
endBottom
,
startBottom
,
offsetScratch
);
const
forward
=
Cartesian3_default
.
normalize
(
forwardOffset
,
rightScratch
);
let
startUp
=
Cartesian3_default
.
subtract
(
startTop
,
startBottom
,
startUpScratch
);
startUp
=
Cartesian3_default
.
normalize
(
startUp
,
startUp
);
let
rightNormal
=
Cartesian3_default
.
cross
(
forward
,
startUp
,
rightScratch
);
rightNormal
=
Cartesian3_default
.
normalize
(
rightNormal
,
rightNormal
);
let
startPlaneNormal
=
Cartesian3_default
.
cross
(
startUp
,
startGeometryNormal
,
startPlaneNormalScratch
);
startPlaneNormal
=
Cartesian3_default
.
normalize
(
startPlaneNormal
,
startPlaneNormal
);
let
endUp
=
Cartesian3_default
.
subtract
(
endTop
,
endBottom
,
endUpScratch
);
endUp
=
Cartesian3_default
.
normalize
(
endUp
,
endUp
);
let
endPlaneNormal
=
Cartesian3_default
.
cross
(
endGeometryNormal
,
endUp
,
endPlaneNormalScratch
);
endPlaneNormal
=
Cartesian3_default
.
normalize
(
endPlaneNormal
,
endPlaneNormal
);
const
texcoordNormalization3DX
=
segmentLength3D
/
length3D
;
const
texcoordNormalization3DY
=
lengthSoFar3D
/
length3D
;
let
segmentLength2D
=
0
;
let
encodedStart2D
;
let
forwardOffset2D
;
let
right2D
;
let
texcoordNormalization2DX
=
0
;
let
texcoordNormalization2DY
=
0
;
if
(
compute2dAttributes
)
{
segmentLength2D
=
Cartesian3_default
.
distance
(
start2D
,
end2D
);
encodedStart2D
=
EncodedCartesian3_default
.
fromCartesian
(
start2D
,
encodeScratch2D
);
forwardOffset2D
=
Cartesian3_default
.
subtract
(
end2D
,
start2D
,
forwardOffset2DScratch
);
right2D
=
Cartesian3_default
.
normalize
(
forwardOffset2D
,
right2DScratch
);
const
swap
=
right2D
.
x
;
right2D
.
x
=
right2D
.
y
;
right2D
.
y
=
-
swap
;
texcoordNormalization2DX
=
segmentLength2D
/
length2D
;
texcoordNormalization2DY
=
lengthSoFar2D
/
length2D
;
}
for
(
j
=
0
;
j
<
8
;
j
++
)
{
const
vec4Index
=
vec4sWriteIndex
+
j
*
4
;
const
vec2Index
=
vec2sWriteIndex
+
j
*
2
;
const
wIndex
=
vec4Index
+
3
;
const
rightPlaneSide
=
j
<
4
?
1
:
-
1
;
const
topBottomSide
=
j
===
2
||
j
===
3
||
j
===
6
||
j
===
7
?
1
:
-
1
;
Cartesian3_default
.
pack
(
encodedStart
.
high
,
startHiAndForwardOffsetX
,
vec4Index
);
startHiAndForwardOffsetX
[
wIndex
]
=
forwardOffset
.
x
;
Cartesian3_default
.
pack
(
encodedStart
.
low
,
startLoAndForwardOffsetY
,
vec4Index
);
startLoAndForwardOffsetY
[
wIndex
]
=
forwardOffset
.
y
;
Cartesian3_default
.
pack
(
startPlaneNormal
,
startNormalAndForwardOffsetZ
,
vec4Index
);
startNormalAndForwardOffsetZ
[
wIndex
]
=
forwardOffset
.
z
;
Cartesian3_default
.
pack
(
endPlaneNormal
,
endNormalAndTextureCoordinateNormalizationX
,
vec4Index
);
endNormalAndTextureCoordinateNormalizationX
[
wIndex
]
=
texcoordNormalization3DX
*
rightPlaneSide
;
Cartesian3_default
.
pack
(
rightNormal
,
rightNormalAndTextureCoordinateNormalizationY
,
vec4Index
);
let
texcoordNormalization
=
texcoordNormalization3DY
*
topBottomSide
;
if
(
texcoordNormalization
===
0
&&
topBottomSide
<
0
)
{
texcoordNormalization
=
9
;
}
rightNormalAndTextureCoordinateNormalizationY
[
wIndex
]
=
texcoordNormalization
;
if
(
compute2dAttributes
)
{
startHiLo2D
[
vec4Index
]
=
encodedStart2D
.
high
.
x
;
startHiLo2D
[
vec4Index
+
1
]
=
encodedStart2D
.
high
.
y
;
startHiLo2D
[
vec4Index
+
2
]
=
encodedStart2D
.
low
.
x
;
startHiLo2D
[
vec4Index
+
3
]
=
encodedStart2D
.
low
.
y
;
startEndNormals2D
[
vec4Index
]
=
-
startGeometryNormal2D
.
y
;
startEndNormals2D
[
vec4Index
+
1
]
=
startGeometryNormal2D
.
x
;
startEndNormals2D
[
vec4Index
+
2
]
=
endGeometryNormal2D
.
y
;
startEndNormals2D
[
vec4Index
+
3
]
=
-
endGeometryNormal2D
.
x
;
offsetAndRight2D
[
vec4Index
]
=
forwardOffset2D
.
x
;
offsetAndRight2D
[
vec4Index
+
1
]
=
forwardOffset2D
.
y
;
offsetAndRight2D
[
vec4Index
+
2
]
=
right2D
.
x
;
offsetAndRight2D
[
vec4Index
+
3
]
=
right2D
.
y
;
texcoordNormalization2D
[
vec2Index
]
=
texcoordNormalization2DX
*
rightPlaneSide
;
texcoordNormalization
=
texcoordNormalization2DY
*
topBottomSide
;
if
(
texcoordNormalization
===
0
&&
topBottomSide
<
0
)
{
texcoordNormalization
=
9
;
}
texcoordNormalization2D
[
vec2Index
+
1
]
=
texcoordNormalization
;
}
}
const
adjustHeightStartBottom
=
adjustHeightStartBottomScratch
;
const
adjustHeightEndBottom
=
adjustHeightEndBottomScratch
;
const
adjustHeightStartTop
=
adjustHeightStartTopScratch
;
const
adjustHeightEndTop
=
adjustHeightEndTopScratch
;
const
getHeightsRectangle
=
Rectangle_default
.
fromCartographicArray
(
getHeightCartographics
,
getHeightRectangleScratch
);
const
minMaxHeights
=
ApproximateTerrainHeights_default
.
getMinimumMaximumHeights
(
getHeightsRectangle
,
ellipsoid
);
const
minHeight
=
minMaxHeights
.
minimumTerrainHeight
;
const
maxHeight
=
minMaxHeights
.
maximumTerrainHeight
;
sumHeights
+=
Math
.
abs
(
minHeight
);
sumHeights
+=
Math
.
abs
(
maxHeight
);
adjustHeights
(
startBottom
,
startTop
,
minHeight
,
maxHeight
,
adjustHeightStartBottom
,
adjustHeightStartTop
);
adjustHeights
(
endBottom
,
endTop
,
minHeight
,
maxHeight
,
adjustHeightEndBottom
,
adjustHeightEndTop
);
let
normalNudge
=
Cartesian3_default
.
multiplyByScalar
(
rightNormal
,
Math_default
.
EPSILON5
,
normalNudgeScratch
);
Cartesian3_default
.
add
(
adjustHeightStartBottom
,
normalNudge
,
adjustHeightStartBottom
);
Cartesian3_default
.
add
(
adjustHeightEndBottom
,
normalNudge
,
adjustHeightEndBottom
);
Cartesian3_default
.
add
(
adjustHeightStartTop
,
normalNudge
,
adjustHeightStartTop
);
Cartesian3_default
.
add
(
adjustHeightEndTop
,
normalNudge
,
adjustHeightEndTop
);
nudgeXZ
(
adjustHeightStartBottom
,
adjustHeightEndBottom
);
nudgeXZ
(
adjustHeightStartTop
,
adjustHeightEndTop
);
Cartesian3_default
.
pack
(
adjustHeightStartBottom
,
positionsArray
,
vec3sWriteIndex
);
Cartesian3_default
.
pack
(
adjustHeightEndBottom
,
positionsArray
,
vec3sWriteIndex
+
3
);
Cartesian3_default
.
pack
(
adjustHeightEndTop
,
positionsArray
,
vec3sWriteIndex
+
6
);
Cartesian3_default
.
pack
(
adjustHeightStartTop
,
positionsArray
,
vec3sWriteIndex
+
9
);
normalNudge
=
Cartesian3_default
.
multiplyByScalar
(
rightNormal
,
-
2
*
Math_default
.
EPSILON5
,
normalNudgeScratch
);
Cartesian3_default
.
add
(
adjustHeightStartBottom
,
normalNudge
,
adjustHeightStartBottom
);
Cartesian3_default
.
add
(
adjustHeightEndBottom
,
normalNudge
,
adjustHeightEndBottom
);
Cartesian3_default
.
add
(
adjustHeightStartTop
,
normalNudge
,
adjustHeightStartTop
);
Cartesian3_default
.
add
(
adjustHeightEndTop
,
normalNudge
,
adjustHeightEndTop
);
nudgeXZ
(
adjustHeightStartBottom
,
adjustHeightEndBottom
);
nudgeXZ
(
adjustHeightStartTop
,
adjustHeightEndTop
);
Cartesian3_default
.
pack
(
adjustHeightStartBottom
,
positionsArray
,
vec3sWriteIndex
+
12
);
Cartesian3_default
.
pack
(
adjustHeightEndBottom
,
positionsArray
,
vec3sWriteIndex
+
15
);
Cartesian3_default
.
pack
(
adjustHeightEndTop
,
positionsArray
,
vec3sWriteIndex
+
18
);
Cartesian3_default
.
pack
(
adjustHeightStartTop
,
positionsArray
,
vec3sWriteIndex
+
21
);
cartographicsIndex
+=
2
;
index
+=
3
;
vec2sWriteIndex
+=
16
;
vec3sWriteIndex
+=
24
;
vec4sWriteIndex
+=
32
;
lengthSoFar3D
+=
segmentLength3D
;
lengthSoFar2D
+=
segmentLength2D
;
}
index
=
0
;
let
indexOffset
=
0
;
for
(
i
=
0
;
i
<
segmentCount
;
i
++
)
{
for
(
j
=
0
;
j
<
REFERENCE_INDICES_LENGTH
;
j
++
)
{
indices
[
index
+
j
]
=
REFERENCE_INDICES
[
j
]
+
indexOffset
;
}
indexOffset
+=
8
;
index
+=
REFERENCE_INDICES_LENGTH
;
}
const
boundingSpheres
=
scratchBoundingSpheres
;
BoundingSphere_default
.
fromVertices
(
bottomPositionsArray
,
Cartesian3_default
.
ZERO
,
3
,
boundingSpheres
[
0
]
);
BoundingSphere_default
.
fromVertices
(
topPositionsArray
,
Cartesian3_default
.
ZERO
,
3
,
boundingSpheres
[
1
]
);
const
boundingSphere
=
BoundingSphere_default
.
fromBoundingSpheres
(
boundingSpheres
);
boundingSphere
.
radius
+=
sumHeights
/
(
segmentCount
*
2
);
const
attributes
=
{
position
:
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
DOUBLE
,
componentsPerAttribute
:
3
,
normalize
:
false
,
values
:
positionsArray
}),
startHiAndForwardOffsetX
:
getVec4GeometryAttribute
(
startHiAndForwardOffsetX
),
startLoAndForwardOffsetY
:
getVec4GeometryAttribute
(
startLoAndForwardOffsetY
),
startNormalAndForwardOffsetZ
:
getVec4GeometryAttribute
(
startNormalAndForwardOffsetZ
),
endNormalAndTextureCoordinateNormalizationX
:
getVec4GeometryAttribute
(
endNormalAndTextureCoordinateNormalizationX
),
rightNormalAndTextureCoordinateNormalizationY
:
getVec4GeometryAttribute
(
rightNormalAndTextureCoordinateNormalizationY
)
};
if
(
compute2dAttributes
)
{
attributes
.
startHiLo2D
=
getVec4GeometryAttribute
(
startHiLo2D
);
attributes
.
offsetAndRight2D
=
getVec4GeometryAttribute
(
offsetAndRight2D
);
attributes
.
startEndNormals2D
=
getVec4GeometryAttribute
(
startEndNormals2D
);
attributes
.
texcoordNormalization2D
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
FLOAT
,
componentsPerAttribute
:
2
,
normalize
:
false
,
values
:
texcoordNormalization2D
});
}
return
new
Geometry_default
({
attributes
,
indices
,
boundingSphere
});
}
function
getVec4GeometryAttribute
(
typedArray
)
{
return
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
FLOAT
,
componentsPerAttribute
:
4
,
normalize
:
false
,
values
:
typedArray
});
}
GroundPolylineGeometry
.
_projectNormal
=
projectNormal
;
var
GroundPolylineGeometry_default
=
GroundPolylineGeometry
;
// packages/engine/Source/Workers/createGroundPolylineGeometry.js
function
createGroundPolylineGeometry
(
groundPolylineGeometry
,
offset
)
{
return
ApproximateTerrainHeights_default
.
initialize
().
then
(
function
()
{
if
(
defined_default
(
offset
))
{
groundPolylineGeometry
=
GroundPolylineGeometry_default
.
unpack
(
groundPolylineGeometry
,
offset
);
}
return
GroundPolylineGeometry_default
.
createGeometry
(
groundPolylineGeometry
);
});
}
var
createGroundPolylineGeometry_default
=
createGroundPolylineGeometry
;
export
{
createGroundPolylineGeometry_default
as
default
};
public/assets/cesium/Workers/createPlaneGeometry.js
0 → 100644
View file @
155e1be1
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import
{
VertexFormat_default
}
from
"
./chunk-JBSKHTNX.js
"
;
import
{
GeometryAttributes_default
}
from
"
./chunk-X7IQYYHF.js
"
;
import
{
GeometryAttribute_default
,
Geometry_default
,
PrimitiveType_default
}
from
"
./chunk-JXVLNVXC.js
"
;
import
{
BoundingSphere_default
}
from
"
./chunk-KHZNBFOH.js
"
;
import
"
./chunk-6SQMLVGV.js
"
;
import
{
ComponentDatatype_default
}
from
"
./chunk-XIUSRWL6.js
"
;
import
{
Cartesian3_default
}
from
"
./chunk-FFLMY4TE.js
"
;
import
"
./chunk-WGDFYAGC.js
"
;
import
"
./chunk-3HQMMUPU.js
"
;
import
"
./chunk-LLAF3CPH.js
"
;
import
{
defaultValue_default
}
from
"
./chunk-U5HSOKPQ.js
"
;
import
{
Check_default
}
from
"
./chunk-P6TRGU3S.js
"
;
import
{
defined_default
}
from
"
./chunk-YCDZX5LS.js
"
;
// packages/engine/Source/Core/PlaneGeometry.js
function
PlaneGeometry
(
options
)
{
options
=
defaultValue_default
(
options
,
defaultValue_default
.
EMPTY_OBJECT
);
const
vertexFormat
=
defaultValue_default
(
options
.
vertexFormat
,
VertexFormat_default
.
DEFAULT
);
this
.
_vertexFormat
=
vertexFormat
;
this
.
_workerName
=
"
createPlaneGeometry
"
;
}
PlaneGeometry
.
packedLength
=
VertexFormat_default
.
packedLength
;
PlaneGeometry
.
pack
=
function
(
value
,
array
,
startingIndex
)
{
Check_default
.
typeOf
.
object
(
"
value
"
,
value
);
Check_default
.
defined
(
"
array
"
,
array
);
startingIndex
=
defaultValue_default
(
startingIndex
,
0
);
VertexFormat_default
.
pack
(
value
.
_vertexFormat
,
array
,
startingIndex
);
return
array
;
};
var
scratchVertexFormat
=
new
VertexFormat_default
();
var
scratchOptions
=
{
vertexFormat
:
scratchVertexFormat
};
PlaneGeometry
.
unpack
=
function
(
array
,
startingIndex
,
result
)
{
Check_default
.
defined
(
"
array
"
,
array
);
startingIndex
=
defaultValue_default
(
startingIndex
,
0
);
const
vertexFormat
=
VertexFormat_default
.
unpack
(
array
,
startingIndex
,
scratchVertexFormat
);
if
(
!
defined_default
(
result
))
{
return
new
PlaneGeometry
(
scratchOptions
);
}
result
.
_vertexFormat
=
VertexFormat_default
.
clone
(
vertexFormat
,
result
.
_vertexFormat
);
return
result
;
};
var
min
=
new
Cartesian3_default
(
-
0.5
,
-
0.5
,
0
);
var
max
=
new
Cartesian3_default
(
0.5
,
0.5
,
0
);
PlaneGeometry
.
createGeometry
=
function
(
planeGeometry
)
{
const
vertexFormat
=
planeGeometry
.
_vertexFormat
;
const
attributes
=
new
GeometryAttributes_default
();
let
indices
;
let
positions
;
if
(
vertexFormat
.
position
)
{
positions
=
new
Float64Array
(
4
*
3
);
positions
[
0
]
=
min
.
x
;
positions
[
1
]
=
min
.
y
;
positions
[
2
]
=
0
;
positions
[
3
]
=
max
.
x
;
positions
[
4
]
=
min
.
y
;
positions
[
5
]
=
0
;
positions
[
6
]
=
max
.
x
;
positions
[
7
]
=
max
.
y
;
positions
[
8
]
=
0
;
positions
[
9
]
=
min
.
x
;
positions
[
10
]
=
max
.
y
;
positions
[
11
]
=
0
;
attributes
.
position
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
DOUBLE
,
componentsPerAttribute
:
3
,
values
:
positions
});
if
(
vertexFormat
.
normal
)
{
const
normals
=
new
Float32Array
(
4
*
3
);
normals
[
0
]
=
0
;
normals
[
1
]
=
0
;
normals
[
2
]
=
1
;
normals
[
3
]
=
0
;
normals
[
4
]
=
0
;
normals
[
5
]
=
1
;
normals
[
6
]
=
0
;
normals
[
7
]
=
0
;
normals
[
8
]
=
1
;
normals
[
9
]
=
0
;
normals
[
10
]
=
0
;
normals
[
11
]
=
1
;
attributes
.
normal
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
FLOAT
,
componentsPerAttribute
:
3
,
values
:
normals
});
}
if
(
vertexFormat
.
st
)
{
const
texCoords
=
new
Float32Array
(
4
*
2
);
texCoords
[
0
]
=
0
;
texCoords
[
1
]
=
0
;
texCoords
[
2
]
=
1
;
texCoords
[
3
]
=
0
;
texCoords
[
4
]
=
1
;
texCoords
[
5
]
=
1
;
texCoords
[
6
]
=
0
;
texCoords
[
7
]
=
1
;
attributes
.
st
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
FLOAT
,
componentsPerAttribute
:
2
,
values
:
texCoords
});
}
if
(
vertexFormat
.
tangent
)
{
const
tangents
=
new
Float32Array
(
4
*
3
);
tangents
[
0
]
=
1
;
tangents
[
1
]
=
0
;
tangents
[
2
]
=
0
;
tangents
[
3
]
=
1
;
tangents
[
4
]
=
0
;
tangents
[
5
]
=
0
;
tangents
[
6
]
=
1
;
tangents
[
7
]
=
0
;
tangents
[
8
]
=
0
;
tangents
[
9
]
=
1
;
tangents
[
10
]
=
0
;
tangents
[
11
]
=
0
;
attributes
.
tangent
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
FLOAT
,
componentsPerAttribute
:
3
,
values
:
tangents
});
}
if
(
vertexFormat
.
bitangent
)
{
const
bitangents
=
new
Float32Array
(
4
*
3
);
bitangents
[
0
]
=
0
;
bitangents
[
1
]
=
1
;
bitangents
[
2
]
=
0
;
bitangents
[
3
]
=
0
;
bitangents
[
4
]
=
1
;
bitangents
[
5
]
=
0
;
bitangents
[
6
]
=
0
;
bitangents
[
7
]
=
1
;
bitangents
[
8
]
=
0
;
bitangents
[
9
]
=
0
;
bitangents
[
10
]
=
1
;
bitangents
[
11
]
=
0
;
attributes
.
bitangent
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
FLOAT
,
componentsPerAttribute
:
3
,
values
:
bitangents
});
}
indices
=
new
Uint16Array
(
2
*
3
);
indices
[
0
]
=
0
;
indices
[
1
]
=
1
;
indices
[
2
]
=
2
;
indices
[
3
]
=
0
;
indices
[
4
]
=
2
;
indices
[
5
]
=
3
;
}
return
new
Geometry_default
({
attributes
,
indices
,
primitiveType
:
PrimitiveType_default
.
TRIANGLES
,
boundingSphere
:
new
BoundingSphere_default
(
Cartesian3_default
.
ZERO
,
Math
.
sqrt
(
2
))
});
};
var
PlaneGeometry_default
=
PlaneGeometry
;
// packages/engine/Source/Workers/createPlaneGeometry.js
function
createPlaneGeometry
(
planeGeometry
,
offset
)
{
if
(
defined_default
(
offset
))
{
planeGeometry
=
PlaneGeometry_default
.
unpack
(
planeGeometry
,
offset
);
}
return
PlaneGeometry_default
.
createGeometry
(
planeGeometry
);
}
var
createPlaneGeometry_default
=
createPlaneGeometry
;
export
{
createPlaneGeometry_default
as
default
};
public/assets/cesium/Workers/createPlaneOutlineGeometry.js
0 → 100644
View file @
155e1be1
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import
{
GeometryAttributes_default
}
from
"
./chunk-X7IQYYHF.js
"
;
import
{
GeometryAttribute_default
,
Geometry_default
,
PrimitiveType_default
}
from
"
./chunk-JXVLNVXC.js
"
;
import
{
BoundingSphere_default
}
from
"
./chunk-KHZNBFOH.js
"
;
import
"
./chunk-6SQMLVGV.js
"
;
import
{
ComponentDatatype_default
}
from
"
./chunk-XIUSRWL6.js
"
;
import
{
Cartesian3_default
}
from
"
./chunk-FFLMY4TE.js
"
;
import
"
./chunk-WGDFYAGC.js
"
;
import
"
./chunk-3HQMMUPU.js
"
;
import
"
./chunk-LLAF3CPH.js
"
;
import
"
./chunk-U5HSOKPQ.js
"
;
import
{
Check_default
}
from
"
./chunk-P6TRGU3S.js
"
;
import
{
defined_default
}
from
"
./chunk-YCDZX5LS.js
"
;
// packages/engine/Source/Core/PlaneOutlineGeometry.js
function
PlaneOutlineGeometry
()
{
this
.
_workerName
=
"
createPlaneOutlineGeometry
"
;
}
PlaneOutlineGeometry
.
packedLength
=
0
;
PlaneOutlineGeometry
.
pack
=
function
(
value
,
array
)
{
Check_default
.
defined
(
"
value
"
,
value
);
Check_default
.
defined
(
"
array
"
,
array
);
return
array
;
};
PlaneOutlineGeometry
.
unpack
=
function
(
array
,
startingIndex
,
result
)
{
Check_default
.
defined
(
"
array
"
,
array
);
if
(
!
defined_default
(
result
))
{
return
new
PlaneOutlineGeometry
();
}
return
result
;
};
var
min
=
new
Cartesian3_default
(
-
0.5
,
-
0.5
,
0
);
var
max
=
new
Cartesian3_default
(
0.5
,
0.5
,
0
);
PlaneOutlineGeometry
.
createGeometry
=
function
()
{
const
attributes
=
new
GeometryAttributes_default
();
const
indices
=
new
Uint16Array
(
4
*
2
);
const
positions
=
new
Float64Array
(
4
*
3
);
positions
[
0
]
=
min
.
x
;
positions
[
1
]
=
min
.
y
;
positions
[
2
]
=
min
.
z
;
positions
[
3
]
=
max
.
x
;
positions
[
4
]
=
min
.
y
;
positions
[
5
]
=
min
.
z
;
positions
[
6
]
=
max
.
x
;
positions
[
7
]
=
max
.
y
;
positions
[
8
]
=
min
.
z
;
positions
[
9
]
=
min
.
x
;
positions
[
10
]
=
max
.
y
;
positions
[
11
]
=
min
.
z
;
attributes
.
position
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
DOUBLE
,
componentsPerAttribute
:
3
,
values
:
positions
});
indices
[
0
]
=
0
;
indices
[
1
]
=
1
;
indices
[
2
]
=
1
;
indices
[
3
]
=
2
;
indices
[
4
]
=
2
;
indices
[
5
]
=
3
;
indices
[
6
]
=
3
;
indices
[
7
]
=
0
;
return
new
Geometry_default
({
attributes
,
indices
,
primitiveType
:
PrimitiveType_default
.
LINES
,
boundingSphere
:
new
BoundingSphere_default
(
Cartesian3_default
.
ZERO
,
Math
.
sqrt
(
2
))
});
};
var
PlaneOutlineGeometry_default
=
PlaneOutlineGeometry
;
// packages/engine/Source/Workers/createPlaneOutlineGeometry.js
function
createPlaneOutlineGeometry
(
planeGeometry
,
offset
)
{
if
(
defined_default
(
offset
))
{
planeGeometry
=
PlaneOutlineGeometry_default
.
unpack
(
planeGeometry
,
offset
);
}
return
PlaneOutlineGeometry_default
.
createGeometry
(
planeGeometry
);
}
var
createPlaneOutlineGeometry_default
=
createPlaneOutlineGeometry
;
export
{
createPlaneOutlineGeometry_default
as
default
};
public/assets/cesium/Workers/createPolygonGeometry.js
0 → 100644
View file @
155e1be1
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import
{
BoundingRectangle_default
}
from
"
./chunk-44QAAS4P.js
"
;
import
{
PolygonGeometryLibrary_default
}
from
"
./chunk-IZJ42N4W.js
"
;
import
{
ArcType_default
}
from
"
./chunk-XWOUPGUF.js
"
;
import
{
GeometryInstance_default
}
from
"
./chunk-YSIJTJ7N.js
"
;
import
{
GeometryPipeline_default
}
from
"
./chunk-7ZZ5LMZY.js
"
;
import
"
./chunk-LJ2JQHJT.js
"
;
import
"
./chunk-NGZJIN5Z.js
"
;
import
{
GeometryOffsetAttribute_default
}
from
"
./chunk-GBT7MJ6X.js
"
;
import
{
VertexFormat_default
}
from
"
./chunk-JBSKHTNX.js
"
;
import
{
EllipsoidTangentPlane_default
}
from
"
./chunk-YK3QIKY7.js
"
;
import
"
./chunk-NDDI2LWR.js
"
;
import
{
PolygonPipeline_default
,
WindingOrder_default
}
from
"
./chunk-TI3TRKIC.js
"
;
import
"
./chunk-57H6I3SV.js
"
;
import
"
./chunk-JSQJDZI4.js
"
;
import
{
IntersectionTests_default
,
Ray_default
}
from
"
./chunk-QQOZO7KO.js
"
;
import
"
./chunk-EDLRS3AW.js
"
;
import
{
IndexDatatype_default
}
from
"
./chunk-C4WPMOKT.js
"
;
import
"
./chunk-X7IQYYHF.js
"
;
import
{
GeometryAttribute_default
,
Geometry_default
}
from
"
./chunk-JXVLNVXC.js
"
;
import
{
BoundingSphere_default
}
from
"
./chunk-KHZNBFOH.js
"
;
import
{
Quaternion_default
,
Rectangle_default
}
from
"
./chunk-6SQMLVGV.js
"
;
import
{
ComponentDatatype_default
}
from
"
./chunk-XIUSRWL6.js
"
;
import
{
Cartesian2_default
,
Cartesian3_default
,
Cartographic_default
,
Ellipsoid_default
,
Matrix3_default
}
from
"
./chunk-FFLMY4TE.js
"
;
import
{
Math_default
}
from
"
./chunk-WGDFYAGC.js
"
;
import
"
./chunk-3HQMMUPU.js
"
;
import
"
./chunk-LLAF3CPH.js
"
;
import
{
defaultValue_default
}
from
"
./chunk-U5HSOKPQ.js
"
;
import
{
Check_default
,
DeveloperError_default
}
from
"
./chunk-P6TRGU3S.js
"
;
import
{
defined_default
}
from
"
./chunk-YCDZX5LS.js
"
;
// packages/engine/Source/Core/Stereographic.js
function
Stereographic
(
position
,
tangentPlane
)
{
this
.
position
=
position
;
if
(
!
defined_default
(
this
.
position
))
{
this
.
position
=
new
Cartesian2_default
();
}
this
.
tangentPlane
=
tangentPlane
;
if
(
!
defined_default
(
this
.
tangentPlane
))
{
this
.
tangentPlane
=
Stereographic
.
NORTH_POLE_TANGENT_PLANE
;
}
}
Object
.
defineProperties
(
Stereographic
.
prototype
,
{
/**
* Gets the ellipsoid.
* @memberof Stereographic.prototype
* @type {Ellipsoid}
*/
ellipsoid
:
{
get
:
function
()
{
return
this
.
tangentPlane
.
ellipsoid
;
}
},
/**
* Gets the x coordinate
* @memberof Stereographic.prototype
* @type {number}
*/
x
:
{
get
:
function
()
{
return
this
.
position
.
x
;
}
},
/**
* Gets the y coordinate
* @memberof Stereographic.prototype
* @type {number}
*/
y
:
{
get
:
function
()
{
return
this
.
position
.
y
;
}
},
/**
* Computes the conformal latitude, or the ellipsoidal latitude projected onto an arbitrary sphere.
* @memberof Stereographic.prototype
* @type {number}
*/
conformalLatitude
:
{
get
:
function
()
{
const
r
=
Cartesian2_default
.
magnitude
(
this
.
position
);
const
d
=
2
*
this
.
ellipsoid
.
maximumRadius
;
const
sign
=
this
.
tangentPlane
.
plane
.
normal
.
z
;
return
sign
*
(
Math_default
.
PI_OVER_TWO
-
2
*
Math
.
atan2
(
r
,
d
));
}
},
/**
* Computes the longitude
* @memberof Stereographic.prototype
* @type {number}
*/
longitude
:
{
get
:
function
()
{
let
longitude
=
Math_default
.
PI_OVER_TWO
+
Math
.
atan2
(
this
.
y
,
this
.
x
);
if
(
longitude
>
Math
.
PI
)
{
longitude
-=
Math_default
.
TWO_PI
;
}
return
longitude
;
}
}
});
var
scratchCartographic
=
new
Cartographic_default
();
var
scratchCartesian
=
new
Cartesian3_default
();
Stereographic
.
prototype
.
getLatitude
=
function
(
ellipsoid
)
{
if
(
!
defined_default
(
ellipsoid
))
{
ellipsoid
=
Ellipsoid_default
.
default
;
}
scratchCartographic
.
latitude
=
this
.
conformalLatitude
;
scratchCartographic
.
longitude
=
this
.
longitude
;
scratchCartographic
.
height
=
0
;
const
cartesian
=
this
.
ellipsoid
.
cartographicToCartesian
(
scratchCartographic
,
scratchCartesian
);
ellipsoid
.
cartesianToCartographic
(
cartesian
,
scratchCartographic
);
return
scratchCartographic
.
latitude
;
};
var
scratchProjectPointOntoPlaneRay
=
new
Ray_default
();
var
scratchProjectPointOntoPlaneRayDirection
=
new
Cartesian3_default
();
var
scratchProjectPointOntoPlaneCartesian3
=
new
Cartesian3_default
();
Stereographic
.
fromCartesian
=
function
(
cartesian
,
result
)
{
Check_default
.
defined
(
"
cartesian
"
,
cartesian
);
const
sign
=
Math_default
.
signNotZero
(
cartesian
.
z
);
let
tangentPlane
=
Stereographic
.
NORTH_POLE_TANGENT_PLANE
;
let
origin
=
Stereographic
.
SOUTH_POLE
;
if
(
sign
<
0
)
{
tangentPlane
=
Stereographic
.
SOUTH_POLE_TANGENT_PLANE
;
origin
=
Stereographic
.
NORTH_POLE
;
}
const
ray
=
scratchProjectPointOntoPlaneRay
;
ray
.
origin
=
tangentPlane
.
ellipsoid
.
scaleToGeocentricSurface
(
cartesian
,
ray
.
origin
);
ray
.
direction
=
Cartesian3_default
.
subtract
(
ray
.
origin
,
origin
,
scratchProjectPointOntoPlaneRayDirection
);
Cartesian3_default
.
normalize
(
ray
.
direction
,
ray
.
direction
);
const
intersectionPoint
=
IntersectionTests_default
.
rayPlane
(
ray
,
tangentPlane
.
plane
,
scratchProjectPointOntoPlaneCartesian3
);
const
v
=
Cartesian3_default
.
subtract
(
intersectionPoint
,
origin
,
intersectionPoint
);
const
x
=
Cartesian3_default
.
dot
(
tangentPlane
.
xAxis
,
v
);
const
y
=
sign
*
Cartesian3_default
.
dot
(
tangentPlane
.
yAxis
,
v
);
if
(
!
defined_default
(
result
))
{
return
new
Stereographic
(
new
Cartesian2_default
(
x
,
y
),
tangentPlane
);
}
result
.
position
=
new
Cartesian2_default
(
x
,
y
);
result
.
tangentPlane
=
tangentPlane
;
return
result
;
};
Stereographic
.
fromCartesianArray
=
function
(
cartesians
,
result
)
{
Check_default
.
defined
(
"
cartesians
"
,
cartesians
);
const
length
=
cartesians
.
length
;
if
(
!
defined_default
(
result
))
{
result
=
new
Array
(
length
);
}
else
{
result
.
length
=
length
;
}
for
(
let
i
=
0
;
i
<
length
;
i
++
)
{
result
[
i
]
=
Stereographic
.
fromCartesian
(
cartesians
[
i
],
result
[
i
]);
}
return
result
;
};
Stereographic
.
clone
=
function
(
stereographic
,
result
)
{
if
(
!
defined_default
(
stereographic
))
{
return
void
0
;
}
if
(
!
defined_default
(
result
))
{
return
new
Stereographic
(
stereographic
.
position
,
stereographic
.
tangentPlane
);
}
result
.
position
=
stereographic
.
position
;
result
.
tangentPlane
=
stereographic
.
tangentPlane
;
return
result
;
};
Stereographic
.
HALF_UNIT_SPHERE
=
Object
.
freeze
(
new
Ellipsoid_default
(
0.5
,
0.5
,
0.5
));
Stereographic
.
NORTH_POLE
=
Object
.
freeze
(
new
Cartesian3_default
(
0
,
0
,
0.5
));
Stereographic
.
SOUTH_POLE
=
Object
.
freeze
(
new
Cartesian3_default
(
0
,
0
,
-
0.5
));
Stereographic
.
NORTH_POLE_TANGENT_PLANE
=
Object
.
freeze
(
new
EllipsoidTangentPlane_default
(
Stereographic
.
NORTH_POLE
,
Stereographic
.
HALF_UNIT_SPHERE
)
);
Stereographic
.
SOUTH_POLE_TANGENT_PLANE
=
Object
.
freeze
(
new
EllipsoidTangentPlane_default
(
Stereographic
.
SOUTH_POLE
,
Stereographic
.
HALF_UNIT_SPHERE
)
);
var
Stereographic_default
=
Stereographic
;
// packages/engine/Source/Core/PolygonGeometry.js
var
scratchCarto1
=
new
Cartographic_default
();
var
scratchCarto2
=
new
Cartographic_default
();
function
adjustPosHeightsForNormal
(
position
,
p1
,
p2
,
ellipsoid
)
{
const
carto1
=
ellipsoid
.
cartesianToCartographic
(
position
,
scratchCarto1
);
const
height
=
carto1
.
height
;
const
p1Carto
=
ellipsoid
.
cartesianToCartographic
(
p1
,
scratchCarto2
);
p1Carto
.
height
=
height
;
ellipsoid
.
cartographicToCartesian
(
p1Carto
,
p1
);
const
p2Carto
=
ellipsoid
.
cartesianToCartographic
(
p2
,
scratchCarto2
);
p2Carto
.
height
=
height
-
100
;
ellipsoid
.
cartographicToCartesian
(
p2Carto
,
p2
);
}
var
scratchBoundingRectangle
=
new
BoundingRectangle_default
();
var
scratchPosition
=
new
Cartesian3_default
();
var
scratchNormal
=
new
Cartesian3_default
();
var
scratchTangent
=
new
Cartesian3_default
();
var
scratchBitangent
=
new
Cartesian3_default
();
var
p1Scratch
=
new
Cartesian3_default
();
var
p2Scratch
=
new
Cartesian3_default
();
var
scratchPerPosNormal
=
new
Cartesian3_default
();
var
scratchPerPosTangent
=
new
Cartesian3_default
();
var
scratchPerPosBitangent
=
new
Cartesian3_default
();
var
appendTextureCoordinatesOrigin
=
new
Cartesian2_default
();
var
appendTextureCoordinatesCartesian2
=
new
Cartesian2_default
();
var
appendTextureCoordinatesCartesian3
=
new
Cartesian3_default
();
var
appendTextureCoordinatesQuaternion
=
new
Quaternion_default
();
var
appendTextureCoordinatesMatrix3
=
new
Matrix3_default
();
var
tangentMatrixScratch
=
new
Matrix3_default
();
function
computeAttributes
(
options
)
{
const
vertexFormat
=
options
.
vertexFormat
;
const
geometry
=
options
.
geometry
;
const
shadowVolume
=
options
.
shadowVolume
;
const
flatPositions
=
geometry
.
attributes
.
position
.
values
;
const
flatTexcoords
=
defined_default
(
geometry
.
attributes
.
st
)
?
geometry
.
attributes
.
st
.
values
:
void
0
;
let
length
=
flatPositions
.
length
;
const
wall
=
options
.
wall
;
const
top
=
options
.
top
||
wall
;
const
bottom
=
options
.
bottom
||
wall
;
if
(
vertexFormat
.
st
||
vertexFormat
.
normal
||
vertexFormat
.
tangent
||
vertexFormat
.
bitangent
||
shadowVolume
)
{
const
boundingRectangle
=
options
.
boundingRectangle
;
const
rotationAxis
=
options
.
rotationAxis
;
const
projectTo2d
=
options
.
projectTo2d
;
const
ellipsoid
=
options
.
ellipsoid
;
const
stRotation
=
options
.
stRotation
;
const
perPositionHeight
=
options
.
perPositionHeight
;
const
origin
=
appendTextureCoordinatesOrigin
;
origin
.
x
=
boundingRectangle
.
x
;
origin
.
y
=
boundingRectangle
.
y
;
const
textureCoordinates
=
vertexFormat
.
st
?
new
Float32Array
(
2
*
(
length
/
3
))
:
void
0
;
let
normals
;
if
(
vertexFormat
.
normal
)
{
if
(
perPositionHeight
&&
top
&&
!
wall
)
{
normals
=
geometry
.
attributes
.
normal
.
values
;
}
else
{
normals
=
new
Float32Array
(
length
);
}
}
const
tangents
=
vertexFormat
.
tangent
?
new
Float32Array
(
length
)
:
void
0
;
const
bitangents
=
vertexFormat
.
bitangent
?
new
Float32Array
(
length
)
:
void
0
;
const
extrudeNormals
=
shadowVolume
?
new
Float32Array
(
length
)
:
void
0
;
let
textureCoordIndex
=
0
;
let
attrIndex
=
0
;
let
normal
=
scratchNormal
;
let
tangent
=
scratchTangent
;
let
bitangent
=
scratchBitangent
;
let
recomputeNormal
=
true
;
let
textureMatrix
=
appendTextureCoordinatesMatrix3
;
let
tangentRotationMatrix
=
tangentMatrixScratch
;
if
(
stRotation
!==
0
)
{
let
rotation
=
Quaternion_default
.
fromAxisAngle
(
rotationAxis
,
stRotation
,
appendTextureCoordinatesQuaternion
);
textureMatrix
=
Matrix3_default
.
fromQuaternion
(
rotation
,
textureMatrix
);
rotation
=
Quaternion_default
.
fromAxisAngle
(
rotationAxis
,
-
stRotation
,
appendTextureCoordinatesQuaternion
);
tangentRotationMatrix
=
Matrix3_default
.
fromQuaternion
(
rotation
,
tangentRotationMatrix
);
}
else
{
textureMatrix
=
Matrix3_default
.
clone
(
Matrix3_default
.
IDENTITY
,
textureMatrix
);
tangentRotationMatrix
=
Matrix3_default
.
clone
(
Matrix3_default
.
IDENTITY
,
tangentRotationMatrix
);
}
let
bottomOffset
=
0
;
let
bottomOffset2
=
0
;
if
(
top
&&
bottom
)
{
bottomOffset
=
length
/
2
;
bottomOffset2
=
length
/
3
;
length
/=
2
;
}
for
(
let
i
=
0
;
i
<
length
;
i
+=
3
)
{
const
position
=
Cartesian3_default
.
fromArray
(
flatPositions
,
i
,
appendTextureCoordinatesCartesian3
);
if
(
vertexFormat
.
st
)
{
if
(
!
defined_default
(
flatTexcoords
))
{
let
p
=
Matrix3_default
.
multiplyByVector
(
textureMatrix
,
position
,
scratchPosition
);
p
=
ellipsoid
.
scaleToGeodeticSurface
(
p
,
p
);
const
st
=
projectTo2d
([
p
],
appendTextureCoordinatesCartesian2
)[
0
];
Cartesian2_default
.
subtract
(
st
,
origin
,
st
);
const
stx
=
Math_default
.
clamp
(
st
.
x
/
boundingRectangle
.
width
,
0
,
1
);
const
sty
=
Math_default
.
clamp
(
st
.
y
/
boundingRectangle
.
height
,
0
,
1
);
if
(
bottom
)
{
textureCoordinates
[
textureCoordIndex
+
bottomOffset2
]
=
stx
;
textureCoordinates
[
textureCoordIndex
+
1
+
bottomOffset2
]
=
sty
;
}
if
(
top
)
{
textureCoordinates
[
textureCoordIndex
]
=
stx
;
textureCoordinates
[
textureCoordIndex
+
1
]
=
sty
;
}
textureCoordIndex
+=
2
;
}
}
if
(
vertexFormat
.
normal
||
vertexFormat
.
tangent
||
vertexFormat
.
bitangent
||
shadowVolume
)
{
const
attrIndex1
=
attrIndex
+
1
;
const
attrIndex2
=
attrIndex
+
2
;
if
(
wall
)
{
if
(
i
+
3
<
length
)
{
const
p1
=
Cartesian3_default
.
fromArray
(
flatPositions
,
i
+
3
,
p1Scratch
);
if
(
recomputeNormal
)
{
const
p2
=
Cartesian3_default
.
fromArray
(
flatPositions
,
i
+
length
,
p2Scratch
);
if
(
perPositionHeight
)
{
adjustPosHeightsForNormal
(
position
,
p1
,
p2
,
ellipsoid
);
}
Cartesian3_default
.
subtract
(
p1
,
position
,
p1
);
Cartesian3_default
.
subtract
(
p2
,
position
,
p2
);
normal
=
Cartesian3_default
.
normalize
(
Cartesian3_default
.
cross
(
p2
,
p1
,
normal
),
normal
);
recomputeNormal
=
false
;
}
if
(
Cartesian3_default
.
equalsEpsilon
(
p1
,
position
,
Math_default
.
EPSILON10
))
{
recomputeNormal
=
true
;
}
}
if
(
vertexFormat
.
tangent
||
vertexFormat
.
bitangent
)
{
bitangent
=
ellipsoid
.
geodeticSurfaceNormal
(
position
,
bitangent
);
if
(
vertexFormat
.
tangent
)
{
tangent
=
Cartesian3_default
.
normalize
(
Cartesian3_default
.
cross
(
bitangent
,
normal
,
tangent
),
tangent
);
}
}
}
else
{
normal
=
ellipsoid
.
geodeticSurfaceNormal
(
position
,
normal
);
if
(
vertexFormat
.
tangent
||
vertexFormat
.
bitangent
)
{
if
(
perPositionHeight
)
{
scratchPerPosNormal
=
Cartesian3_default
.
fromArray
(
normals
,
attrIndex
,
scratchPerPosNormal
);
scratchPerPosTangent
=
Cartesian3_default
.
cross
(
Cartesian3_default
.
UNIT_Z
,
scratchPerPosNormal
,
scratchPerPosTangent
);
scratchPerPosTangent
=
Cartesian3_default
.
normalize
(
Matrix3_default
.
multiplyByVector
(
tangentRotationMatrix
,
scratchPerPosTangent
,
scratchPerPosTangent
),
scratchPerPosTangent
);
if
(
vertexFormat
.
bitangent
)
{
scratchPerPosBitangent
=
Cartesian3_default
.
normalize
(
Cartesian3_default
.
cross
(
scratchPerPosNormal
,
scratchPerPosTangent
,
scratchPerPosBitangent
),
scratchPerPosBitangent
);
}
}
tangent
=
Cartesian3_default
.
cross
(
Cartesian3_default
.
UNIT_Z
,
normal
,
tangent
);
tangent
=
Cartesian3_default
.
normalize
(
Matrix3_default
.
multiplyByVector
(
tangentRotationMatrix
,
tangent
,
tangent
),
tangent
);
if
(
vertexFormat
.
bitangent
)
{
bitangent
=
Cartesian3_default
.
normalize
(
Cartesian3_default
.
cross
(
normal
,
tangent
,
bitangent
),
bitangent
);
}
}
}
if
(
vertexFormat
.
normal
)
{
if
(
options
.
wall
)
{
normals
[
attrIndex
+
bottomOffset
]
=
normal
.
x
;
normals
[
attrIndex1
+
bottomOffset
]
=
normal
.
y
;
normals
[
attrIndex2
+
bottomOffset
]
=
normal
.
z
;
}
else
if
(
bottom
)
{
normals
[
attrIndex
+
bottomOffset
]
=
-
normal
.
x
;
normals
[
attrIndex1
+
bottomOffset
]
=
-
normal
.
y
;
normals
[
attrIndex2
+
bottomOffset
]
=
-
normal
.
z
;
}
if
(
top
&&
!
perPositionHeight
||
wall
)
{
normals
[
attrIndex
]
=
normal
.
x
;
normals
[
attrIndex1
]
=
normal
.
y
;
normals
[
attrIndex2
]
=
normal
.
z
;
}
}
if
(
shadowVolume
)
{
if
(
wall
)
{
normal
=
ellipsoid
.
geodeticSurfaceNormal
(
position
,
normal
);
}
extrudeNormals
[
attrIndex
+
bottomOffset
]
=
-
normal
.
x
;
extrudeNormals
[
attrIndex1
+
bottomOffset
]
=
-
normal
.
y
;
extrudeNormals
[
attrIndex2
+
bottomOffset
]
=
-
normal
.
z
;
}
if
(
vertexFormat
.
tangent
)
{
if
(
options
.
wall
)
{
tangents
[
attrIndex
+
bottomOffset
]
=
tangent
.
x
;
tangents
[
attrIndex1
+
bottomOffset
]
=
tangent
.
y
;
tangents
[
attrIndex2
+
bottomOffset
]
=
tangent
.
z
;
}
else
if
(
bottom
)
{
tangents
[
attrIndex
+
bottomOffset
]
=
-
tangent
.
x
;
tangents
[
attrIndex1
+
bottomOffset
]
=
-
tangent
.
y
;
tangents
[
attrIndex2
+
bottomOffset
]
=
-
tangent
.
z
;
}
if
(
top
)
{
if
(
perPositionHeight
)
{
tangents
[
attrIndex
]
=
scratchPerPosTangent
.
x
;
tangents
[
attrIndex1
]
=
scratchPerPosTangent
.
y
;
tangents
[
attrIndex2
]
=
scratchPerPosTangent
.
z
;
}
else
{
tangents
[
attrIndex
]
=
tangent
.
x
;
tangents
[
attrIndex1
]
=
tangent
.
y
;
tangents
[
attrIndex2
]
=
tangent
.
z
;
}
}
}
if
(
vertexFormat
.
bitangent
)
{
if
(
bottom
)
{
bitangents
[
attrIndex
+
bottomOffset
]
=
bitangent
.
x
;
bitangents
[
attrIndex1
+
bottomOffset
]
=
bitangent
.
y
;
bitangents
[
attrIndex2
+
bottomOffset
]
=
bitangent
.
z
;
}
if
(
top
)
{
if
(
perPositionHeight
)
{
bitangents
[
attrIndex
]
=
scratchPerPosBitangent
.
x
;
bitangents
[
attrIndex1
]
=
scratchPerPosBitangent
.
y
;
bitangents
[
attrIndex2
]
=
scratchPerPosBitangent
.
z
;
}
else
{
bitangents
[
attrIndex
]
=
bitangent
.
x
;
bitangents
[
attrIndex1
]
=
bitangent
.
y
;
bitangents
[
attrIndex2
]
=
bitangent
.
z
;
}
}
}
attrIndex
+=
3
;
}
}
if
(
vertexFormat
.
st
&&
!
defined_default
(
flatTexcoords
))
{
geometry
.
attributes
.
st
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
FLOAT
,
componentsPerAttribute
:
2
,
values
:
textureCoordinates
});
}
if
(
vertexFormat
.
normal
)
{
geometry
.
attributes
.
normal
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
FLOAT
,
componentsPerAttribute
:
3
,
values
:
normals
});
}
if
(
vertexFormat
.
tangent
)
{
geometry
.
attributes
.
tangent
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
FLOAT
,
componentsPerAttribute
:
3
,
values
:
tangents
});
}
if
(
vertexFormat
.
bitangent
)
{
geometry
.
attributes
.
bitangent
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
FLOAT
,
componentsPerAttribute
:
3
,
values
:
bitangents
});
}
if
(
shadowVolume
)
{
geometry
.
attributes
.
extrudeDirection
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
FLOAT
,
componentsPerAttribute
:
3
,
values
:
extrudeNormals
});
}
}
if
(
options
.
extrude
&&
defined_default
(
options
.
offsetAttribute
))
{
const
size
=
flatPositions
.
length
/
3
;
let
offsetAttribute
=
new
Uint8Array
(
size
);
if
(
options
.
offsetAttribute
===
GeometryOffsetAttribute_default
.
TOP
)
{
if
(
top
&&
bottom
||
wall
)
{
offsetAttribute
=
offsetAttribute
.
fill
(
1
,
0
,
size
/
2
);
}
else
if
(
top
)
{
offsetAttribute
=
offsetAttribute
.
fill
(
1
);
}
}
else
{
const
offsetValue
=
options
.
offsetAttribute
===
GeometryOffsetAttribute_default
.
NONE
?
0
:
1
;
offsetAttribute
=
offsetAttribute
.
fill
(
offsetValue
);
}
geometry
.
attributes
.
applyOffset
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
UNSIGNED_BYTE
,
componentsPerAttribute
:
1
,
values
:
offsetAttribute
});
}
return
geometry
;
}
var
createGeometryFromPositionsExtrudedPositions
=
[];
function
createGeometryFromPositionsExtruded
(
ellipsoid
,
polygon2
,
textureCoordinates
,
granularity
,
hierarchy
,
perPositionHeight
,
closeTop
,
closeBottom
,
vertexFormat
,
arcType
)
{
const
geos
=
{
walls
:
[]
};
let
i
;
if
(
closeTop
||
closeBottom
)
{
const
topGeo
=
PolygonGeometryLibrary_default
.
createGeometryFromPositions
(
ellipsoid
,
polygon2
,
textureCoordinates
,
granularity
,
perPositionHeight
,
vertexFormat
,
arcType
);
const
edgePoints
=
topGeo
.
attributes
.
position
.
values
;
const
indices
=
topGeo
.
indices
;
let
numPositions
;
let
newIndices
;
if
(
closeTop
&&
closeBottom
)
{
const
topBottomPositions
=
edgePoints
.
concat
(
edgePoints
);
numPositions
=
topBottomPositions
.
length
/
3
;
newIndices
=
IndexDatatype_default
.
createTypedArray
(
numPositions
,
indices
.
length
*
2
);
newIndices
.
set
(
indices
);
const
ilength
=
indices
.
length
;
const
length
=
numPositions
/
2
;
for
(
i
=
0
;
i
<
ilength
;
i
+=
3
)
{
const
i0
=
newIndices
[
i
]
+
length
;
const
i1
=
newIndices
[
i
+
1
]
+
length
;
const
i2
=
newIndices
[
i
+
2
]
+
length
;
newIndices
[
i
+
ilength
]
=
i2
;
newIndices
[
i
+
1
+
ilength
]
=
i1
;
newIndices
[
i
+
2
+
ilength
]
=
i0
;
}
topGeo
.
attributes
.
position
.
values
=
topBottomPositions
;
if
(
perPositionHeight
&&
vertexFormat
.
normal
)
{
const
normals
=
topGeo
.
attributes
.
normal
.
values
;
topGeo
.
attributes
.
normal
.
values
=
new
Float32Array
(
topBottomPositions
.
length
);
topGeo
.
attributes
.
normal
.
values
.
set
(
normals
);
}
if
(
vertexFormat
.
st
&&
defined_default
(
textureCoordinates
))
{
const
texcoords
=
topGeo
.
attributes
.
st
.
values
;
topGeo
.
attributes
.
st
.
values
=
new
Float32Array
(
numPositions
*
2
);
topGeo
.
attributes
.
st
.
values
=
texcoords
.
concat
(
texcoords
);
}
topGeo
.
indices
=
newIndices
;
}
else
if
(
closeBottom
)
{
numPositions
=
edgePoints
.
length
/
3
;
newIndices
=
IndexDatatype_default
.
createTypedArray
(
numPositions
,
indices
.
length
);
for
(
i
=
0
;
i
<
indices
.
length
;
i
+=
3
)
{
newIndices
[
i
]
=
indices
[
i
+
2
];
newIndices
[
i
+
1
]
=
indices
[
i
+
1
];
newIndices
[
i
+
2
]
=
indices
[
i
];
}
topGeo
.
indices
=
newIndices
;
}
geos
.
topAndBottom
=
new
GeometryInstance_default
({
geometry
:
topGeo
});
}
let
outerRing
=
hierarchy
.
outerRing
;
const
tangentPlane
=
EllipsoidTangentPlane_default
.
fromPoints
(
outerRing
,
ellipsoid
);
let
positions2D
=
tangentPlane
.
projectPointsOntoPlane
(
outerRing
,
createGeometryFromPositionsExtrudedPositions
);
let
windingOrder
=
PolygonPipeline_default
.
computeWindingOrder2D
(
positions2D
);
if
(
windingOrder
===
WindingOrder_default
.
CLOCKWISE
)
{
outerRing
=
outerRing
.
slice
().
reverse
();
}
let
wallGeo
=
PolygonGeometryLibrary_default
.
computeWallGeometry
(
outerRing
,
textureCoordinates
,
ellipsoid
,
granularity
,
perPositionHeight
,
arcType
);
geos
.
walls
.
push
(
new
GeometryInstance_default
({
geometry
:
wallGeo
})
);
const
holes
=
hierarchy
.
holes
;
for
(
i
=
0
;
i
<
holes
.
length
;
i
++
)
{
let
hole
=
holes
[
i
];
positions2D
=
tangentPlane
.
projectPointsOntoPlane
(
hole
,
createGeometryFromPositionsExtrudedPositions
);
windingOrder
=
PolygonPipeline_default
.
computeWindingOrder2D
(
positions2D
);
if
(
windingOrder
===
WindingOrder_default
.
COUNTER_CLOCKWISE
)
{
hole
=
hole
.
slice
().
reverse
();
}
wallGeo
=
PolygonGeometryLibrary_default
.
computeWallGeometry
(
hole
,
textureCoordinates
,
ellipsoid
,
granularity
,
perPositionHeight
,
arcType
);
geos
.
walls
.
push
(
new
GeometryInstance_default
({
geometry
:
wallGeo
})
);
}
return
geos
;
}
function
PolygonGeometry
(
options
)
{
Check_default
.
typeOf
.
object
(
"
options
"
,
options
);
Check_default
.
typeOf
.
object
(
"
options.polygonHierarchy
"
,
options
.
polygonHierarchy
);
if
(
defined_default
(
options
.
perPositionHeight
)
&&
options
.
perPositionHeight
&&
defined_default
(
options
.
height
))
{
throw
new
DeveloperError_default
(
"
Cannot use both options.perPositionHeight and options.height
"
);
}
if
(
defined_default
(
options
.
arcType
)
&&
options
.
arcType
!==
ArcType_default
.
GEODESIC
&&
options
.
arcType
!==
ArcType_default
.
RHUMB
)
{
throw
new
DeveloperError_default
(
"
Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB.
"
);
}
const
polygonHierarchy
=
options
.
polygonHierarchy
;
const
vertexFormat
=
defaultValue_default
(
options
.
vertexFormat
,
VertexFormat_default
.
DEFAULT
);
const
ellipsoid
=
defaultValue_default
(
options
.
ellipsoid
,
Ellipsoid_default
.
default
);
const
granularity
=
defaultValue_default
(
options
.
granularity
,
Math_default
.
RADIANS_PER_DEGREE
);
const
stRotation
=
defaultValue_default
(
options
.
stRotation
,
0
);
const
textureCoordinates
=
options
.
textureCoordinates
;
const
perPositionHeight
=
defaultValue_default
(
options
.
perPositionHeight
,
false
);
const
perPositionHeightExtrude
=
perPositionHeight
&&
defined_default
(
options
.
extrudedHeight
);
let
height
=
defaultValue_default
(
options
.
height
,
0
);
let
extrudedHeight
=
defaultValue_default
(
options
.
extrudedHeight
,
height
);
if
(
!
perPositionHeightExtrude
)
{
const
h
=
Math
.
max
(
height
,
extrudedHeight
);
extrudedHeight
=
Math
.
min
(
height
,
extrudedHeight
);
height
=
h
;
}
this
.
_vertexFormat
=
VertexFormat_default
.
clone
(
vertexFormat
);
this
.
_ellipsoid
=
Ellipsoid_default
.
clone
(
ellipsoid
);
this
.
_granularity
=
granularity
;
this
.
_stRotation
=
stRotation
;
this
.
_height
=
height
;
this
.
_extrudedHeight
=
extrudedHeight
;
this
.
_closeTop
=
defaultValue_default
(
options
.
closeTop
,
true
);
this
.
_closeBottom
=
defaultValue_default
(
options
.
closeBottom
,
true
);
this
.
_polygonHierarchy
=
polygonHierarchy
;
this
.
_perPositionHeight
=
perPositionHeight
;
this
.
_perPositionHeightExtrude
=
perPositionHeightExtrude
;
this
.
_shadowVolume
=
defaultValue_default
(
options
.
shadowVolume
,
false
);
this
.
_workerName
=
"
createPolygonGeometry
"
;
this
.
_offsetAttribute
=
options
.
offsetAttribute
;
this
.
_arcType
=
defaultValue_default
(
options
.
arcType
,
ArcType_default
.
GEODESIC
);
this
.
_rectangle
=
void
0
;
this
.
_textureCoordinateRotationPoints
=
void
0
;
this
.
_textureCoordinates
=
textureCoordinates
;
this
.
packedLength
=
PolygonGeometryLibrary_default
.
computeHierarchyPackedLength
(
polygonHierarchy
,
Cartesian3_default
)
+
Ellipsoid_default
.
packedLength
+
VertexFormat_default
.
packedLength
+
(
textureCoordinates
?
PolygonGeometryLibrary_default
.
computeHierarchyPackedLength
(
textureCoordinates
,
Cartesian2_default
)
:
1
)
+
12
;
}
PolygonGeometry
.
fromPositions
=
function
(
options
)
{
options
=
defaultValue_default
(
options
,
defaultValue_default
.
EMPTY_OBJECT
);
Check_default
.
defined
(
"
options.positions
"
,
options
.
positions
);
const
newOptions
=
{
polygonHierarchy
:
{
positions
:
options
.
positions
},
height
:
options
.
height
,
extrudedHeight
:
options
.
extrudedHeight
,
vertexFormat
:
options
.
vertexFormat
,
stRotation
:
options
.
stRotation
,
ellipsoid
:
options
.
ellipsoid
,
granularity
:
options
.
granularity
,
perPositionHeight
:
options
.
perPositionHeight
,
closeTop
:
options
.
closeTop
,
closeBottom
:
options
.
closeBottom
,
offsetAttribute
:
options
.
offsetAttribute
,
arcType
:
options
.
arcType
,
textureCoordinates
:
options
.
textureCoordinates
};
return
new
PolygonGeometry
(
newOptions
);
};
PolygonGeometry
.
pack
=
function
(
value
,
array
,
startingIndex
)
{
Check_default
.
typeOf
.
object
(
"
value
"
,
value
);
Check_default
.
defined
(
"
array
"
,
array
);
startingIndex
=
defaultValue_default
(
startingIndex
,
0
);
startingIndex
=
PolygonGeometryLibrary_default
.
packPolygonHierarchy
(
value
.
_polygonHierarchy
,
array
,
startingIndex
,
Cartesian3_default
);
Ellipsoid_default
.
pack
(
value
.
_ellipsoid
,
array
,
startingIndex
);
startingIndex
+=
Ellipsoid_default
.
packedLength
;
VertexFormat_default
.
pack
(
value
.
_vertexFormat
,
array
,
startingIndex
);
startingIndex
+=
VertexFormat_default
.
packedLength
;
array
[
startingIndex
++
]
=
value
.
_height
;
array
[
startingIndex
++
]
=
value
.
_extrudedHeight
;
array
[
startingIndex
++
]
=
value
.
_granularity
;
array
[
startingIndex
++
]
=
value
.
_stRotation
;
array
[
startingIndex
++
]
=
value
.
_perPositionHeightExtrude
?
1
:
0
;
array
[
startingIndex
++
]
=
value
.
_perPositionHeight
?
1
:
0
;
array
[
startingIndex
++
]
=
value
.
_closeTop
?
1
:
0
;
array
[
startingIndex
++
]
=
value
.
_closeBottom
?
1
:
0
;
array
[
startingIndex
++
]
=
value
.
_shadowVolume
?
1
:
0
;
array
[
startingIndex
++
]
=
defaultValue_default
(
value
.
_offsetAttribute
,
-
1
);
array
[
startingIndex
++
]
=
value
.
_arcType
;
if
(
defined_default
(
value
.
_textureCoordinates
))
{
startingIndex
=
PolygonGeometryLibrary_default
.
packPolygonHierarchy
(
value
.
_textureCoordinates
,
array
,
startingIndex
,
Cartesian2_default
);
}
else
{
array
[
startingIndex
++
]
=
-
1
;
}
array
[
startingIndex
++
]
=
value
.
packedLength
;
return
array
;
};
var
scratchEllipsoid
=
Ellipsoid_default
.
clone
(
Ellipsoid_default
.
UNIT_SPHERE
);
var
scratchVertexFormat
=
new
VertexFormat_default
();
var
dummyOptions
=
{
polygonHierarchy
:
{}
};
PolygonGeometry
.
unpack
=
function
(
array
,
startingIndex
,
result
)
{
Check_default
.
defined
(
"
array
"
,
array
);
startingIndex
=
defaultValue_default
(
startingIndex
,
0
);
const
polygonHierarchy
=
PolygonGeometryLibrary_default
.
unpackPolygonHierarchy
(
array
,
startingIndex
,
Cartesian3_default
);
startingIndex
=
polygonHierarchy
.
startingIndex
;
delete
polygonHierarchy
.
startingIndex
;
const
ellipsoid
=
Ellipsoid_default
.
unpack
(
array
,
startingIndex
,
scratchEllipsoid
);
startingIndex
+=
Ellipsoid_default
.
packedLength
;
const
vertexFormat
=
VertexFormat_default
.
unpack
(
array
,
startingIndex
,
scratchVertexFormat
);
startingIndex
+=
VertexFormat_default
.
packedLength
;
const
height
=
array
[
startingIndex
++
];
const
extrudedHeight
=
array
[
startingIndex
++
];
const
granularity
=
array
[
startingIndex
++
];
const
stRotation
=
array
[
startingIndex
++
];
const
perPositionHeightExtrude
=
array
[
startingIndex
++
]
===
1
;
const
perPositionHeight
=
array
[
startingIndex
++
]
===
1
;
const
closeTop
=
array
[
startingIndex
++
]
===
1
;
const
closeBottom
=
array
[
startingIndex
++
]
===
1
;
const
shadowVolume
=
array
[
startingIndex
++
]
===
1
;
const
offsetAttribute
=
array
[
startingIndex
++
];
const
arcType
=
array
[
startingIndex
++
];
const
textureCoordinates
=
array
[
startingIndex
]
===
-
1
?
void
0
:
PolygonGeometryLibrary_default
.
unpackPolygonHierarchy
(
array
,
startingIndex
,
Cartesian2_default
);
if
(
defined_default
(
textureCoordinates
))
{
startingIndex
=
textureCoordinates
.
startingIndex
;
delete
textureCoordinates
.
startingIndex
;
}
else
{
startingIndex
++
;
}
const
packedLength
=
array
[
startingIndex
++
];
if
(
!
defined_default
(
result
))
{
result
=
new
PolygonGeometry
(
dummyOptions
);
}
result
.
_polygonHierarchy
=
polygonHierarchy
;
result
.
_ellipsoid
=
Ellipsoid_default
.
clone
(
ellipsoid
,
result
.
_ellipsoid
);
result
.
_vertexFormat
=
VertexFormat_default
.
clone
(
vertexFormat
,
result
.
_vertexFormat
);
result
.
_height
=
height
;
result
.
_extrudedHeight
=
extrudedHeight
;
result
.
_granularity
=
granularity
;
result
.
_stRotation
=
stRotation
;
result
.
_perPositionHeightExtrude
=
perPositionHeightExtrude
;
result
.
_perPositionHeight
=
perPositionHeight
;
result
.
_closeTop
=
closeTop
;
result
.
_closeBottom
=
closeBottom
;
result
.
_shadowVolume
=
shadowVolume
;
result
.
_offsetAttribute
=
offsetAttribute
===
-
1
?
void
0
:
offsetAttribute
;
result
.
_arcType
=
arcType
;
result
.
_textureCoordinates
=
textureCoordinates
;
result
.
packedLength
=
packedLength
;
return
result
;
};
var
scratchCartesian0
=
new
Cartesian2_default
();
var
scratchCartesian1
=
new
Cartesian2_default
();
var
scratchPolarClosest
=
new
Stereographic_default
();
function
expandRectangle
(
polar
,
lastPolar
,
ellipsoid
,
arcType
,
polygon2
,
result
)
{
const
longitude
=
polar
.
longitude
;
const
lonAdjusted
=
longitude
>=
0
?
longitude
:
longitude
+
Math_default
.
TWO_PI
;
polygon2
.
westOverIdl
=
Math
.
min
(
polygon2
.
westOverIdl
,
lonAdjusted
);
polygon2
.
eastOverIdl
=
Math
.
max
(
polygon2
.
eastOverIdl
,
lonAdjusted
);
result
.
west
=
Math
.
min
(
result
.
west
,
longitude
);
result
.
east
=
Math
.
max
(
result
.
east
,
longitude
);
const
latitude
=
polar
.
getLatitude
(
ellipsoid
);
let
segmentLatitude
=
latitude
;
result
.
south
=
Math
.
min
(
result
.
south
,
latitude
);
result
.
north
=
Math
.
max
(
result
.
north
,
latitude
);
if
(
arcType
!==
ArcType_default
.
RHUMB
)
{
const
segment
=
Cartesian2_default
.
subtract
(
lastPolar
.
position
,
polar
.
position
,
scratchCartesian0
);
const
t
=
Cartesian2_default
.
dot
(
lastPolar
.
position
,
segment
)
/
Cartesian2_default
.
dot
(
segment
,
segment
);
if
(
t
>
0
&&
t
<
1
)
{
const
projected
=
Cartesian2_default
.
add
(
lastPolar
.
position
,
Cartesian2_default
.
multiplyByScalar
(
segment
,
-
t
,
segment
),
scratchCartesian1
);
const
closestPolar
=
Stereographic_default
.
clone
(
lastPolar
,
scratchPolarClosest
);
closestPolar
.
position
=
projected
;
const
adjustedLatitude
=
closestPolar
.
getLatitude
(
ellipsoid
);
result
.
south
=
Math
.
min
(
result
.
south
,
adjustedLatitude
);
result
.
north
=
Math
.
max
(
result
.
north
,
adjustedLatitude
);
if
(
Math
.
abs
(
latitude
)
>
Math
.
abs
(
adjustedLatitude
))
{
segmentLatitude
=
adjustedLatitude
;
}
}
}
const
direction
=
lastPolar
.
x
*
polar
.
y
-
polar
.
x
*
lastPolar
.
y
;
let
angle
=
Math
.
sign
(
direction
);
if
(
angle
!==
0
)
{
angle
*=
Cartesian2_default
.
angleBetween
(
lastPolar
.
position
,
polar
.
position
);
}
if
(
segmentLatitude
>=
0
)
{
polygon2
.
northAngle
+=
angle
;
}
if
(
segmentLatitude
<=
0
)
{
polygon2
.
southAngle
+=
angle
;
}
}
var
scratchPolar
=
new
Stereographic_default
();
var
scratchPolarPrevious
=
new
Stereographic_default
();
var
polygon
=
{
northAngle
:
0
,
southAngle
:
0
,
westOverIdl
:
0
,
eastOverIdl
:
0
};
PolygonGeometry
.
computeRectangleFromPositions
=
function
(
positions
,
ellipsoid
,
arcType
,
result
)
{
Check_default
.
defined
(
"
positions
"
,
positions
);
if
(
!
defined_default
(
result
))
{
result
=
new
Rectangle_default
();
}
if
(
positions
.
length
<
3
)
{
return
result
;
}
result
.
west
=
Number
.
POSITIVE_INFINITY
;
result
.
east
=
Number
.
NEGATIVE_INFINITY
;
result
.
south
=
Number
.
POSITIVE_INFINITY
;
result
.
north
=
Number
.
NEGATIVE_INFINITY
;
polygon
.
northAngle
=
0
;
polygon
.
southAngle
=
0
;
polygon
.
westOverIdl
=
Number
.
POSITIVE_INFINITY
;
polygon
.
eastOverIdl
=
Number
.
NEGATIVE_INFINITY
;
const
positionsLength
=
positions
.
length
;
let
lastPolarPosition
=
Stereographic_default
.
fromCartesian
(
positions
[
0
],
scratchPolarPrevious
);
for
(
let
i
=
1
;
i
<
positionsLength
;
i
++
)
{
const
polarPosition
=
Stereographic_default
.
fromCartesian
(
positions
[
i
],
scratchPolar
);
expandRectangle
(
polarPosition
,
lastPolarPosition
,
ellipsoid
,
arcType
,
polygon
,
result
);
lastPolarPosition
=
Stereographic_default
.
clone
(
polarPosition
,
lastPolarPosition
);
}
expandRectangle
(
Stereographic_default
.
fromCartesian
(
positions
[
0
],
scratchPolar
),
lastPolarPosition
,
ellipsoid
,
arcType
,
polygon
,
result
);
if
(
result
.
east
-
result
.
west
>
polygon
.
eastOverIdl
-
polygon
.
westOverIdl
)
{
result
.
west
=
polygon
.
westOverIdl
;
result
.
east
=
polygon
.
eastOverIdl
;
if
(
result
.
east
>
Math_default
.
PI
)
{
result
.
east
=
result
.
east
-
Math_default
.
TWO_PI
;
}
if
(
result
.
west
>
Math_default
.
PI
)
{
result
.
west
=
result
.
west
-
Math_default
.
TWO_PI
;
}
}
if
(
Math_default
.
equalsEpsilon
(
Math
.
abs
(
polygon
.
northAngle
),
Math_default
.
TWO_PI
,
Math_default
.
EPSILON10
))
{
result
.
north
=
Math_default
.
PI_OVER_TWO
;
result
.
east
=
Math_default
.
PI
;
result
.
west
=
-
Math_default
.
PI
;
}
if
(
Math_default
.
equalsEpsilon
(
Math
.
abs
(
polygon
.
southAngle
),
Math_default
.
TWO_PI
,
Math_default
.
EPSILON10
))
{
result
.
south
=
-
Math_default
.
PI_OVER_TWO
;
result
.
east
=
Math_default
.
PI
;
result
.
west
=
-
Math_default
.
PI
;
}
return
result
;
};
var
scratchPolarForPlane
=
new
Stereographic_default
();
function
getTangentPlane
(
rectangle
,
positions
,
ellipsoid
)
{
if
(
rectangle
.
height
>=
Math_default
.
PI
||
rectangle
.
width
>=
Math_default
.
PI
)
{
const
polar
=
Stereographic_default
.
fromCartesian
(
positions
[
0
],
scratchPolarForPlane
);
return
polar
.
tangentPlane
;
}
return
EllipsoidTangentPlane_default
.
fromPoints
(
positions
,
ellipsoid
);
}
var
scratchCartographicCyllindrical
=
new
Cartographic_default
();
function
createProjectTo2d
(
rectangle
,
outerPositions
,
ellipsoid
)
{
return
(
positions
,
results
)
=>
{
if
(
rectangle
.
height
>=
Math_default
.
PI
||
rectangle
.
width
>=
Math_default
.
PI
)
{
if
(
rectangle
.
south
<
0
&&
rectangle
.
north
>
0
)
{
if
(
!
defined_default
(
results
))
{
results
=
[];
}
for
(
let
i
=
0
;
i
<
positions
.
length
;
++
i
)
{
const
cartographic
=
ellipsoid
.
cartesianToCartographic
(
positions
[
i
],
scratchCartographicCyllindrical
);
results
[
i
]
=
new
Cartesian2_default
(
cartographic
.
longitude
/
Math_default
.
PI
,
cartographic
.
latitude
/
Math_default
.
PI_OVER_TWO
);
}
results
.
length
=
positions
.
length
;
return
results
;
}
return
Stereographic_default
.
fromCartesianArray
(
positions
,
results
);
}
const
tangentPlane
=
EllipsoidTangentPlane_default
.
fromPoints
(
outerPositions
,
ellipsoid
);
return
tangentPlane
.
projectPointsOntoPlane
(
positions
,
results
);
};
}
function
createProjectPositionTo2d
(
rectangle
,
outerRing
,
ellipsoid
)
{
if
(
rectangle
.
height
>=
Math_default
.
PI
||
rectangle
.
width
>=
Math_default
.
PI
)
{
return
(
position
,
result
)
=>
{
if
(
rectangle
.
south
<
0
&&
rectangle
.
north
>
0
)
{
const
cartographic
=
ellipsoid
.
cartesianToCartographic
(
position
,
scratchCartographicCyllindrical
);
if
(
!
defined_default
(
result
))
{
result
=
new
Cartesian2_default
();
}
result
.
x
=
cartographic
.
longitude
/
Math_default
.
PI
;
result
.
y
=
cartographic
.
latitude
/
Math_default
.
PI_OVER_TWO
;
return
result
;
}
return
Stereographic_default
.
fromCartesian
(
position
,
result
);
};
}
const
tangentPlane
=
EllipsoidTangentPlane_default
.
fromPoints
(
outerRing
,
ellipsoid
);
return
(
position
,
result
)
=>
{
return
tangentPlane
.
projectPointsOntoPlane
(
position
,
result
);
};
}
function
createSplitPolygons
(
rectangle
,
ellipsoid
,
arcType
,
perPositionHeight
)
{
return
(
polygons
,
results
)
=>
{
if
(
!
perPositionHeight
&&
(
rectangle
.
height
>=
Math_default
.
PI_OVER_TWO
||
rectangle
.
width
>=
2
*
Math_default
.
PI_OVER_THREE
))
{
return
PolygonGeometryLibrary_default
.
splitPolygonsOnEquator
(
polygons
,
ellipsoid
,
arcType
,
results
);
}
return
polygons
;
};
}
function
computeBoundingRectangle
(
outerRing
,
rectangle
,
ellipsoid
,
stRotation
)
{
if
(
rectangle
.
height
>=
Math_default
.
PI
||
rectangle
.
width
>=
Math_default
.
PI
)
{
return
BoundingRectangle_default
.
fromRectangle
(
rectangle
,
void
0
,
scratchBoundingRectangle
);
}
const
outerPositions
=
outerRing
;
const
tangentPlane
=
EllipsoidTangentPlane_default
.
fromPoints
(
outerPositions
,
ellipsoid
);
return
PolygonGeometryLibrary_default
.
computeBoundingRectangle
(
tangentPlane
.
plane
.
normal
,
tangentPlane
.
projectPointOntoPlane
.
bind
(
tangentPlane
),
outerPositions
,
stRotation
,
scratchBoundingRectangle
);
}
PolygonGeometry
.
createGeometry
=
function
(
polygonGeometry
)
{
const
vertexFormat
=
polygonGeometry
.
_vertexFormat
;
const
ellipsoid
=
polygonGeometry
.
_ellipsoid
;
const
granularity
=
polygonGeometry
.
_granularity
;
const
stRotation
=
polygonGeometry
.
_stRotation
;
const
polygonHierarchy
=
polygonGeometry
.
_polygonHierarchy
;
const
perPositionHeight
=
polygonGeometry
.
_perPositionHeight
;
const
closeTop
=
polygonGeometry
.
_closeTop
;
const
closeBottom
=
polygonGeometry
.
_closeBottom
;
const
arcType
=
polygonGeometry
.
_arcType
;
const
textureCoordinates
=
polygonGeometry
.
_textureCoordinates
;
const
hasTextureCoordinates
=
defined_default
(
textureCoordinates
);
const
outerPositions
=
polygonHierarchy
.
positions
;
if
(
outerPositions
.
length
<
3
)
{
return
;
}
const
rectangle
=
polygonGeometry
.
rectangle
;
const
results
=
PolygonGeometryLibrary_default
.
polygonsFromHierarchy
(
polygonHierarchy
,
hasTextureCoordinates
,
createProjectTo2d
(
rectangle
,
outerPositions
,
ellipsoid
),
!
perPositionHeight
,
ellipsoid
,
createSplitPolygons
(
rectangle
,
ellipsoid
,
arcType
,
perPositionHeight
)
);
const
hierarchy
=
results
.
hierarchy
;
const
polygons
=
results
.
polygons
;
const
dummyFunction
=
function
(
identity
)
{
return
identity
;
};
const
textureCoordinatePolygons
=
hasTextureCoordinates
?
PolygonGeometryLibrary_default
.
polygonsFromHierarchy
(
textureCoordinates
,
true
,
dummyFunction
,
false
,
ellipsoid
).
polygons
:
void
0
;
if
(
hierarchy
.
length
===
0
)
{
return
;
}
const
outerRing
=
hierarchy
[
0
].
outerRing
;
const
boundingRectangle
=
computeBoundingRectangle
(
outerRing
,
rectangle
,
ellipsoid
,
stRotation
);
const
geometries
=
[];
const
height
=
polygonGeometry
.
_height
;
const
extrudedHeight
=
polygonGeometry
.
_extrudedHeight
;
const
extrude
=
polygonGeometry
.
_perPositionHeightExtrude
||
!
Math_default
.
equalsEpsilon
(
height
,
extrudedHeight
,
0
,
Math_default
.
EPSILON2
);
const
options
=
{
perPositionHeight
,
vertexFormat
,
geometry
:
void
0
,
rotationAxis
:
getTangentPlane
(
rectangle
,
outerRing
,
ellipsoid
).
plane
.
normal
,
projectTo2d
:
createProjectPositionTo2d
(
rectangle
,
outerRing
,
ellipsoid
),
boundingRectangle
,
ellipsoid
,
stRotation
,
textureCoordinates
:
void
0
,
bottom
:
false
,
top
:
true
,
wall
:
false
,
extrude
:
false
,
arcType
};
let
i
;
if
(
extrude
)
{
options
.
extrude
=
true
;
options
.
top
=
closeTop
;
options
.
bottom
=
closeBottom
;
options
.
shadowVolume
=
polygonGeometry
.
_shadowVolume
;
options
.
offsetAttribute
=
polygonGeometry
.
_offsetAttribute
;
for
(
i
=
0
;
i
<
polygons
.
length
;
i
++
)
{
const
splitGeometry
=
createGeometryFromPositionsExtruded
(
ellipsoid
,
polygons
[
i
],
hasTextureCoordinates
?
textureCoordinatePolygons
[
i
]
:
void
0
,
granularity
,
hierarchy
[
i
],
perPositionHeight
,
closeTop
,
closeBottom
,
vertexFormat
,
arcType
);
let
topAndBottom
;
if
(
closeTop
&&
closeBottom
)
{
topAndBottom
=
splitGeometry
.
topAndBottom
;
options
.
geometry
=
PolygonGeometryLibrary_default
.
scaleToGeodeticHeightExtruded
(
topAndBottom
.
geometry
,
height
,
extrudedHeight
,
ellipsoid
,
perPositionHeight
);
}
else
if
(
closeTop
)
{
topAndBottom
=
splitGeometry
.
topAndBottom
;
topAndBottom
.
geometry
.
attributes
.
position
.
values
=
PolygonPipeline_default
.
scaleToGeodeticHeight
(
topAndBottom
.
geometry
.
attributes
.
position
.
values
,
height
,
ellipsoid
,
!
perPositionHeight
);
options
.
geometry
=
topAndBottom
.
geometry
;
}
else
if
(
closeBottom
)
{
topAndBottom
=
splitGeometry
.
topAndBottom
;
topAndBottom
.
geometry
.
attributes
.
position
.
values
=
PolygonPipeline_default
.
scaleToGeodeticHeight
(
topAndBottom
.
geometry
.
attributes
.
position
.
values
,
extrudedHeight
,
ellipsoid
,
true
);
options
.
geometry
=
topAndBottom
.
geometry
;
}
if
(
closeTop
||
closeBottom
)
{
options
.
wall
=
false
;
topAndBottom
.
geometry
=
computeAttributes
(
options
);
geometries
.
push
(
topAndBottom
);
}
const
walls
=
splitGeometry
.
walls
;
options
.
wall
=
true
;
for
(
let
k
=
0
;
k
<
walls
.
length
;
k
++
)
{
const
wall
=
walls
[
k
];
options
.
geometry
=
PolygonGeometryLibrary_default
.
scaleToGeodeticHeightExtruded
(
wall
.
geometry
,
height
,
extrudedHeight
,
ellipsoid
,
perPositionHeight
);
wall
.
geometry
=
computeAttributes
(
options
);
geometries
.
push
(
wall
);
}
}
}
else
{
for
(
i
=
0
;
i
<
polygons
.
length
;
i
++
)
{
const
geometryInstance
=
new
GeometryInstance_default
({
geometry
:
PolygonGeometryLibrary_default
.
createGeometryFromPositions
(
ellipsoid
,
polygons
[
i
],
hasTextureCoordinates
?
textureCoordinatePolygons
[
i
]
:
void
0
,
granularity
,
perPositionHeight
,
vertexFormat
,
arcType
)
});
geometryInstance
.
geometry
.
attributes
.
position
.
values
=
PolygonPipeline_default
.
scaleToGeodeticHeight
(
geometryInstance
.
geometry
.
attributes
.
position
.
values
,
height
,
ellipsoid
,
!
perPositionHeight
);
options
.
geometry
=
geometryInstance
.
geometry
;
geometryInstance
.
geometry
=
computeAttributes
(
options
);
if
(
defined_default
(
polygonGeometry
.
_offsetAttribute
))
{
const
length
=
geometryInstance
.
geometry
.
attributes
.
position
.
values
.
length
;
const
offsetValue
=
polygonGeometry
.
_offsetAttribute
===
GeometryOffsetAttribute_default
.
NONE
?
0
:
1
;
const
applyOffset
=
new
Uint8Array
(
length
/
3
).
fill
(
offsetValue
);
geometryInstance
.
geometry
.
attributes
.
applyOffset
=
new
GeometryAttribute_default
(
{
componentDatatype
:
ComponentDatatype_default
.
UNSIGNED_BYTE
,
componentsPerAttribute
:
1
,
values
:
applyOffset
}
);
}
geometries
.
push
(
geometryInstance
);
}
}
const
geometry
=
GeometryPipeline_default
.
combineInstances
(
geometries
)[
0
];
geometry
.
attributes
.
position
.
values
=
new
Float64Array
(
geometry
.
attributes
.
position
.
values
);
geometry
.
indices
=
IndexDatatype_default
.
createTypedArray
(
geometry
.
attributes
.
position
.
values
.
length
/
3
,
geometry
.
indices
);
const
attributes
=
geometry
.
attributes
;
const
boundingSphere
=
BoundingSphere_default
.
fromVertices
(
attributes
.
position
.
values
);
if
(
!
vertexFormat
.
position
)
{
delete
attributes
.
position
;
}
return
new
Geometry_default
({
attributes
,
indices
:
geometry
.
indices
,
primitiveType
:
geometry
.
primitiveType
,
boundingSphere
,
offsetAttribute
:
polygonGeometry
.
_offsetAttribute
});
};
PolygonGeometry
.
createShadowVolume
=
function
(
polygonGeometry
,
minHeightFunc
,
maxHeightFunc
)
{
const
granularity
=
polygonGeometry
.
_granularity
;
const
ellipsoid
=
polygonGeometry
.
_ellipsoid
;
const
minHeight
=
minHeightFunc
(
granularity
,
ellipsoid
);
const
maxHeight
=
maxHeightFunc
(
granularity
,
ellipsoid
);
return
new
PolygonGeometry
({
polygonHierarchy
:
polygonGeometry
.
_polygonHierarchy
,
ellipsoid
,
stRotation
:
polygonGeometry
.
_stRotation
,
granularity
,
perPositionHeight
:
false
,
extrudedHeight
:
minHeight
,
height
:
maxHeight
,
vertexFormat
:
VertexFormat_default
.
POSITION_ONLY
,
shadowVolume
:
true
,
arcType
:
polygonGeometry
.
_arcType
});
};
function
textureCoordinateRotationPoints
(
polygonGeometry
)
{
const
stRotation
=
-
polygonGeometry
.
_stRotation
;
if
(
stRotation
===
0
)
{
return
[
0
,
0
,
0
,
1
,
1
,
0
];
}
const
ellipsoid
=
polygonGeometry
.
_ellipsoid
;
const
positions
=
polygonGeometry
.
_polygonHierarchy
.
positions
;
const
boundingRectangle
=
polygonGeometry
.
rectangle
;
return
Geometry_default
.
_textureCoordinateRotationPoints
(
positions
,
stRotation
,
ellipsoid
,
boundingRectangle
);
}
Object
.
defineProperties
(
PolygonGeometry
.
prototype
,
{
/**
* @private
*/
rectangle
:
{
get
:
function
()
{
if
(
!
defined_default
(
this
.
_rectangle
))
{
const
positions
=
this
.
_polygonHierarchy
.
positions
;
this
.
_rectangle
=
PolygonGeometry
.
computeRectangleFromPositions
(
positions
,
this
.
_ellipsoid
,
this
.
_arcType
);
}
return
this
.
_rectangle
;
}
},
/**
* For remapping texture coordinates when rendering PolygonGeometries as GroundPrimitives.
* @private
*/
textureCoordinateRotationPoints
:
{
get
:
function
()
{
if
(
!
defined_default
(
this
.
_textureCoordinateRotationPoints
))
{
this
.
_textureCoordinateRotationPoints
=
textureCoordinateRotationPoints
(
this
);
}
return
this
.
_textureCoordinateRotationPoints
;
}
}
});
var
PolygonGeometry_default
=
PolygonGeometry
;
// packages/engine/Source/Workers/createPolygonGeometry.js
function
createPolygonGeometry
(
polygonGeometry
,
offset
)
{
if
(
defined_default
(
offset
))
{
polygonGeometry
=
PolygonGeometry_default
.
unpack
(
polygonGeometry
,
offset
);
}
polygonGeometry
.
_ellipsoid
=
Ellipsoid_default
.
clone
(
polygonGeometry
.
_ellipsoid
);
return
PolygonGeometry_default
.
createGeometry
(
polygonGeometry
);
}
var
createPolygonGeometry_default
=
createPolygonGeometry
;
export
{
createPolygonGeometry_default
as
default
};
public/assets/cesium/Workers/createPolygonOutlineGeometry.js
0 → 100644
View file @
155e1be1
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import
{
PolygonGeometryLibrary_default
}
from
"
./chunk-IZJ42N4W.js
"
;
import
{
ArcType_default
}
from
"
./chunk-XWOUPGUF.js
"
;
import
{
GeometryInstance_default
}
from
"
./chunk-YSIJTJ7N.js
"
;
import
{
GeometryPipeline_default
}
from
"
./chunk-7ZZ5LMZY.js
"
;
import
"
./chunk-LJ2JQHJT.js
"
;
import
"
./chunk-NGZJIN5Z.js
"
;
import
{
GeometryOffsetAttribute_default
}
from
"
./chunk-GBT7MJ6X.js
"
;
import
{
EllipsoidTangentPlane_default
}
from
"
./chunk-YK3QIKY7.js
"
;
import
"
./chunk-NDDI2LWR.js
"
;
import
{
PolygonPipeline_default
,
WindingOrder_default
}
from
"
./chunk-TI3TRKIC.js
"
;
import
"
./chunk-57H6I3SV.js
"
;
import
"
./chunk-JSQJDZI4.js
"
;
import
"
./chunk-QQOZO7KO.js
"
;
import
"
./chunk-EDLRS3AW.js
"
;
import
{
IndexDatatype_default
}
from
"
./chunk-C4WPMOKT.js
"
;
import
{
GeometryAttributes_default
}
from
"
./chunk-X7IQYYHF.js
"
;
import
{
GeometryAttribute_default
,
Geometry_default
,
PrimitiveType_default
}
from
"
./chunk-JXVLNVXC.js
"
;
import
{
BoundingSphere_default
}
from
"
./chunk-KHZNBFOH.js
"
;
import
"
./chunk-6SQMLVGV.js
"
;
import
{
ComponentDatatype_default
}
from
"
./chunk-XIUSRWL6.js
"
;
import
{
Cartesian3_default
,
Ellipsoid_default
}
from
"
./chunk-FFLMY4TE.js
"
;
import
{
Math_default
}
from
"
./chunk-WGDFYAGC.js
"
;
import
"
./chunk-3HQMMUPU.js
"
;
import
"
./chunk-LLAF3CPH.js
"
;
import
{
defaultValue_default
}
from
"
./chunk-U5HSOKPQ.js
"
;
import
{
Check_default
,
DeveloperError_default
}
from
"
./chunk-P6TRGU3S.js
"
;
import
{
defined_default
}
from
"
./chunk-YCDZX5LS.js
"
;
// packages/engine/Source/Core/PolygonOutlineGeometry.js
var
createGeometryFromPositionsPositions
=
[];
var
createGeometryFromPositionsSubdivided
=
[];
function
createGeometryFromPositions
(
ellipsoid
,
positions
,
minDistance
,
perPositionHeight
,
arcType
)
{
const
tangentPlane
=
EllipsoidTangentPlane_default
.
fromPoints
(
positions
,
ellipsoid
);
const
positions2D
=
tangentPlane
.
projectPointsOntoPlane
(
positions
,
createGeometryFromPositionsPositions
);
const
originalWindingOrder
=
PolygonPipeline_default
.
computeWindingOrder2D
(
positions2D
);
if
(
originalWindingOrder
===
WindingOrder_default
.
CLOCKWISE
)
{
positions2D
.
reverse
();
positions
=
positions
.
slice
().
reverse
();
}
let
subdividedPositions
;
let
i
;
let
length
=
positions
.
length
;
let
index
=
0
;
if
(
!
perPositionHeight
)
{
let
numVertices
=
0
;
if
(
arcType
===
ArcType_default
.
GEODESIC
)
{
for
(
i
=
0
;
i
<
length
;
i
++
)
{
numVertices
+=
PolygonGeometryLibrary_default
.
subdivideLineCount
(
positions
[
i
],
positions
[(
i
+
1
)
%
length
],
minDistance
);
}
}
else
if
(
arcType
===
ArcType_default
.
RHUMB
)
{
for
(
i
=
0
;
i
<
length
;
i
++
)
{
numVertices
+=
PolygonGeometryLibrary_default
.
subdivideRhumbLineCount
(
ellipsoid
,
positions
[
i
],
positions
[(
i
+
1
)
%
length
],
minDistance
);
}
}
subdividedPositions
=
new
Float64Array
(
numVertices
*
3
);
for
(
i
=
0
;
i
<
length
;
i
++
)
{
let
tempPositions
;
if
(
arcType
===
ArcType_default
.
GEODESIC
)
{
tempPositions
=
PolygonGeometryLibrary_default
.
subdivideLine
(
positions
[
i
],
positions
[(
i
+
1
)
%
length
],
minDistance
,
createGeometryFromPositionsSubdivided
);
}
else
if
(
arcType
===
ArcType_default
.
RHUMB
)
{
tempPositions
=
PolygonGeometryLibrary_default
.
subdivideRhumbLine
(
ellipsoid
,
positions
[
i
],
positions
[(
i
+
1
)
%
length
],
minDistance
,
createGeometryFromPositionsSubdivided
);
}
const
tempPositionsLength
=
tempPositions
.
length
;
for
(
let
j
=
0
;
j
<
tempPositionsLength
;
++
j
)
{
subdividedPositions
[
index
++
]
=
tempPositions
[
j
];
}
}
}
else
{
subdividedPositions
=
new
Float64Array
(
length
*
2
*
3
);
for
(
i
=
0
;
i
<
length
;
i
++
)
{
const
p0
=
positions
[
i
];
const
p1
=
positions
[(
i
+
1
)
%
length
];
subdividedPositions
[
index
++
]
=
p0
.
x
;
subdividedPositions
[
index
++
]
=
p0
.
y
;
subdividedPositions
[
index
++
]
=
p0
.
z
;
subdividedPositions
[
index
++
]
=
p1
.
x
;
subdividedPositions
[
index
++
]
=
p1
.
y
;
subdividedPositions
[
index
++
]
=
p1
.
z
;
}
}
length
=
subdividedPositions
.
length
/
3
;
const
indicesSize
=
length
*
2
;
const
indices
=
IndexDatatype_default
.
createTypedArray
(
length
,
indicesSize
);
index
=
0
;
for
(
i
=
0
;
i
<
length
-
1
;
i
++
)
{
indices
[
index
++
]
=
i
;
indices
[
index
++
]
=
i
+
1
;
}
indices
[
index
++
]
=
length
-
1
;
indices
[
index
++
]
=
0
;
return
new
GeometryInstance_default
({
geometry
:
new
Geometry_default
({
attributes
:
new
GeometryAttributes_default
({
position
:
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
DOUBLE
,
componentsPerAttribute
:
3
,
values
:
subdividedPositions
})
}),
indices
,
primitiveType
:
PrimitiveType_default
.
LINES
})
});
}
function
createGeometryFromPositionsExtruded
(
ellipsoid
,
positions
,
minDistance
,
perPositionHeight
,
arcType
)
{
const
tangentPlane
=
EllipsoidTangentPlane_default
.
fromPoints
(
positions
,
ellipsoid
);
const
positions2D
=
tangentPlane
.
projectPointsOntoPlane
(
positions
,
createGeometryFromPositionsPositions
);
const
originalWindingOrder
=
PolygonPipeline_default
.
computeWindingOrder2D
(
positions2D
);
if
(
originalWindingOrder
===
WindingOrder_default
.
CLOCKWISE
)
{
positions2D
.
reverse
();
positions
=
positions
.
slice
().
reverse
();
}
let
subdividedPositions
;
let
i
;
let
length
=
positions
.
length
;
const
corners
=
new
Array
(
length
);
let
index
=
0
;
if
(
!
perPositionHeight
)
{
let
numVertices
=
0
;
if
(
arcType
===
ArcType_default
.
GEODESIC
)
{
for
(
i
=
0
;
i
<
length
;
i
++
)
{
numVertices
+=
PolygonGeometryLibrary_default
.
subdivideLineCount
(
positions
[
i
],
positions
[(
i
+
1
)
%
length
],
minDistance
);
}
}
else
if
(
arcType
===
ArcType_default
.
RHUMB
)
{
for
(
i
=
0
;
i
<
length
;
i
++
)
{
numVertices
+=
PolygonGeometryLibrary_default
.
subdivideRhumbLineCount
(
ellipsoid
,
positions
[
i
],
positions
[(
i
+
1
)
%
length
],
minDistance
);
}
}
subdividedPositions
=
new
Float64Array
(
numVertices
*
3
*
2
);
for
(
i
=
0
;
i
<
length
;
++
i
)
{
corners
[
i
]
=
index
/
3
;
let
tempPositions
;
if
(
arcType
===
ArcType_default
.
GEODESIC
)
{
tempPositions
=
PolygonGeometryLibrary_default
.
subdivideLine
(
positions
[
i
],
positions
[(
i
+
1
)
%
length
],
minDistance
,
createGeometryFromPositionsSubdivided
);
}
else
if
(
arcType
===
ArcType_default
.
RHUMB
)
{
tempPositions
=
PolygonGeometryLibrary_default
.
subdivideRhumbLine
(
ellipsoid
,
positions
[
i
],
positions
[(
i
+
1
)
%
length
],
minDistance
,
createGeometryFromPositionsSubdivided
);
}
const
tempPositionsLength
=
tempPositions
.
length
;
for
(
let
j
=
0
;
j
<
tempPositionsLength
;
++
j
)
{
subdividedPositions
[
index
++
]
=
tempPositions
[
j
];
}
}
}
else
{
subdividedPositions
=
new
Float64Array
(
length
*
2
*
3
*
2
);
for
(
i
=
0
;
i
<
length
;
++
i
)
{
corners
[
i
]
=
index
/
3
;
const
p0
=
positions
[
i
];
const
p1
=
positions
[(
i
+
1
)
%
length
];
subdividedPositions
[
index
++
]
=
p0
.
x
;
subdividedPositions
[
index
++
]
=
p0
.
y
;
subdividedPositions
[
index
++
]
=
p0
.
z
;
subdividedPositions
[
index
++
]
=
p1
.
x
;
subdividedPositions
[
index
++
]
=
p1
.
y
;
subdividedPositions
[
index
++
]
=
p1
.
z
;
}
}
length
=
subdividedPositions
.
length
/
(
3
*
2
);
const
cornersLength
=
corners
.
length
;
const
indicesSize
=
(
length
*
2
+
cornersLength
)
*
2
;
const
indices
=
IndexDatatype_default
.
createTypedArray
(
length
+
cornersLength
,
indicesSize
);
index
=
0
;
for
(
i
=
0
;
i
<
length
;
++
i
)
{
indices
[
index
++
]
=
i
;
indices
[
index
++
]
=
(
i
+
1
)
%
length
;
indices
[
index
++
]
=
i
+
length
;
indices
[
index
++
]
=
(
i
+
1
)
%
length
+
length
;
}
for
(
i
=
0
;
i
<
cornersLength
;
i
++
)
{
const
corner
=
corners
[
i
];
indices
[
index
++
]
=
corner
;
indices
[
index
++
]
=
corner
+
length
;
}
return
new
GeometryInstance_default
({
geometry
:
new
Geometry_default
({
attributes
:
new
GeometryAttributes_default
({
position
:
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
DOUBLE
,
componentsPerAttribute
:
3
,
values
:
subdividedPositions
})
}),
indices
,
primitiveType
:
PrimitiveType_default
.
LINES
})
});
}
function
PolygonOutlineGeometry
(
options
)
{
Check_default
.
typeOf
.
object
(
"
options
"
,
options
);
Check_default
.
typeOf
.
object
(
"
options.polygonHierarchy
"
,
options
.
polygonHierarchy
);
if
(
options
.
perPositionHeight
&&
defined_default
(
options
.
height
))
{
throw
new
DeveloperError_default
(
"
Cannot use both options.perPositionHeight and options.height
"
);
}
if
(
defined_default
(
options
.
arcType
)
&&
options
.
arcType
!==
ArcType_default
.
GEODESIC
&&
options
.
arcType
!==
ArcType_default
.
RHUMB
)
{
throw
new
DeveloperError_default
(
"
Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB.
"
);
}
const
polygonHierarchy
=
options
.
polygonHierarchy
;
const
ellipsoid
=
defaultValue_default
(
options
.
ellipsoid
,
Ellipsoid_default
.
default
);
const
granularity
=
defaultValue_default
(
options
.
granularity
,
Math_default
.
RADIANS_PER_DEGREE
);
const
perPositionHeight
=
defaultValue_default
(
options
.
perPositionHeight
,
false
);
const
perPositionHeightExtrude
=
perPositionHeight
&&
defined_default
(
options
.
extrudedHeight
);
const
arcType
=
defaultValue_default
(
options
.
arcType
,
ArcType_default
.
GEODESIC
);
let
height
=
defaultValue_default
(
options
.
height
,
0
);
let
extrudedHeight
=
defaultValue_default
(
options
.
extrudedHeight
,
height
);
if
(
!
perPositionHeightExtrude
)
{
const
h
=
Math
.
max
(
height
,
extrudedHeight
);
extrudedHeight
=
Math
.
min
(
height
,
extrudedHeight
);
height
=
h
;
}
this
.
_ellipsoid
=
Ellipsoid_default
.
clone
(
ellipsoid
);
this
.
_granularity
=
granularity
;
this
.
_height
=
height
;
this
.
_extrudedHeight
=
extrudedHeight
;
this
.
_arcType
=
arcType
;
this
.
_polygonHierarchy
=
polygonHierarchy
;
this
.
_perPositionHeight
=
perPositionHeight
;
this
.
_perPositionHeightExtrude
=
perPositionHeightExtrude
;
this
.
_offsetAttribute
=
options
.
offsetAttribute
;
this
.
_workerName
=
"
createPolygonOutlineGeometry
"
;
this
.
packedLength
=
PolygonGeometryLibrary_default
.
computeHierarchyPackedLength
(
polygonHierarchy
,
Cartesian3_default
)
+
Ellipsoid_default
.
packedLength
+
8
;
}
PolygonOutlineGeometry
.
pack
=
function
(
value
,
array
,
startingIndex
)
{
Check_default
.
typeOf
.
object
(
"
value
"
,
value
);
Check_default
.
defined
(
"
array
"
,
array
);
startingIndex
=
defaultValue_default
(
startingIndex
,
0
);
startingIndex
=
PolygonGeometryLibrary_default
.
packPolygonHierarchy
(
value
.
_polygonHierarchy
,
array
,
startingIndex
,
Cartesian3_default
);
Ellipsoid_default
.
pack
(
value
.
_ellipsoid
,
array
,
startingIndex
);
startingIndex
+=
Ellipsoid_default
.
packedLength
;
array
[
startingIndex
++
]
=
value
.
_height
;
array
[
startingIndex
++
]
=
value
.
_extrudedHeight
;
array
[
startingIndex
++
]
=
value
.
_granularity
;
array
[
startingIndex
++
]
=
value
.
_perPositionHeightExtrude
?
1
:
0
;
array
[
startingIndex
++
]
=
value
.
_perPositionHeight
?
1
:
0
;
array
[
startingIndex
++
]
=
value
.
_arcType
;
array
[
startingIndex
++
]
=
defaultValue_default
(
value
.
_offsetAttribute
,
-
1
);
array
[
startingIndex
]
=
value
.
packedLength
;
return
array
;
};
var
scratchEllipsoid
=
Ellipsoid_default
.
clone
(
Ellipsoid_default
.
UNIT_SPHERE
);
var
dummyOptions
=
{
polygonHierarchy
:
{}
};
PolygonOutlineGeometry
.
unpack
=
function
(
array
,
startingIndex
,
result
)
{
Check_default
.
defined
(
"
array
"
,
array
);
startingIndex
=
defaultValue_default
(
startingIndex
,
0
);
const
polygonHierarchy
=
PolygonGeometryLibrary_default
.
unpackPolygonHierarchy
(
array
,
startingIndex
,
Cartesian3_default
);
startingIndex
=
polygonHierarchy
.
startingIndex
;
delete
polygonHierarchy
.
startingIndex
;
const
ellipsoid
=
Ellipsoid_default
.
unpack
(
array
,
startingIndex
,
scratchEllipsoid
);
startingIndex
+=
Ellipsoid_default
.
packedLength
;
const
height
=
array
[
startingIndex
++
];
const
extrudedHeight
=
array
[
startingIndex
++
];
const
granularity
=
array
[
startingIndex
++
];
const
perPositionHeightExtrude
=
array
[
startingIndex
++
]
===
1
;
const
perPositionHeight
=
array
[
startingIndex
++
]
===
1
;
const
arcType
=
array
[
startingIndex
++
];
const
offsetAttribute
=
array
[
startingIndex
++
];
const
packedLength
=
array
[
startingIndex
];
if
(
!
defined_default
(
result
))
{
result
=
new
PolygonOutlineGeometry
(
dummyOptions
);
}
result
.
_polygonHierarchy
=
polygonHierarchy
;
result
.
_ellipsoid
=
Ellipsoid_default
.
clone
(
ellipsoid
,
result
.
_ellipsoid
);
result
.
_height
=
height
;
result
.
_extrudedHeight
=
extrudedHeight
;
result
.
_granularity
=
granularity
;
result
.
_perPositionHeight
=
perPositionHeight
;
result
.
_perPositionHeightExtrude
=
perPositionHeightExtrude
;
result
.
_arcType
=
arcType
;
result
.
_offsetAttribute
=
offsetAttribute
===
-
1
?
void
0
:
offsetAttribute
;
result
.
packedLength
=
packedLength
;
return
result
;
};
PolygonOutlineGeometry
.
fromPositions
=
function
(
options
)
{
options
=
defaultValue_default
(
options
,
defaultValue_default
.
EMPTY_OBJECT
);
Check_default
.
defined
(
"
options.positions
"
,
options
.
positions
);
const
newOptions
=
{
polygonHierarchy
:
{
positions
:
options
.
positions
},
height
:
options
.
height
,
extrudedHeight
:
options
.
extrudedHeight
,
ellipsoid
:
options
.
ellipsoid
,
granularity
:
options
.
granularity
,
perPositionHeight
:
options
.
perPositionHeight
,
arcType
:
options
.
arcType
,
offsetAttribute
:
options
.
offsetAttribute
};
return
new
PolygonOutlineGeometry
(
newOptions
);
};
PolygonOutlineGeometry
.
createGeometry
=
function
(
polygonGeometry
)
{
const
ellipsoid
=
polygonGeometry
.
_ellipsoid
;
const
granularity
=
polygonGeometry
.
_granularity
;
const
polygonHierarchy
=
polygonGeometry
.
_polygonHierarchy
;
const
perPositionHeight
=
polygonGeometry
.
_perPositionHeight
;
const
arcType
=
polygonGeometry
.
_arcType
;
const
polygons
=
PolygonGeometryLibrary_default
.
polygonOutlinesFromHierarchy
(
polygonHierarchy
,
!
perPositionHeight
,
ellipsoid
);
if
(
polygons
.
length
===
0
)
{
return
void
0
;
}
let
geometryInstance
;
const
geometries
=
[];
const
minDistance
=
Math_default
.
chordLength
(
granularity
,
ellipsoid
.
maximumRadius
);
const
height
=
polygonGeometry
.
_height
;
const
extrudedHeight
=
polygonGeometry
.
_extrudedHeight
;
const
extrude
=
polygonGeometry
.
_perPositionHeightExtrude
||
!
Math_default
.
equalsEpsilon
(
height
,
extrudedHeight
,
0
,
Math_default
.
EPSILON2
);
let
offsetValue
;
let
i
;
if
(
extrude
)
{
for
(
i
=
0
;
i
<
polygons
.
length
;
i
++
)
{
geometryInstance
=
createGeometryFromPositionsExtruded
(
ellipsoid
,
polygons
[
i
],
minDistance
,
perPositionHeight
,
arcType
);
geometryInstance
.
geometry
=
PolygonGeometryLibrary_default
.
scaleToGeodeticHeightExtruded
(
geometryInstance
.
geometry
,
height
,
extrudedHeight
,
ellipsoid
,
perPositionHeight
);
if
(
defined_default
(
polygonGeometry
.
_offsetAttribute
))
{
const
size
=
geometryInstance
.
geometry
.
attributes
.
position
.
values
.
length
/
3
;
let
offsetAttribute
=
new
Uint8Array
(
size
);
if
(
polygonGeometry
.
_offsetAttribute
===
GeometryOffsetAttribute_default
.
TOP
)
{
offsetAttribute
=
offsetAttribute
.
fill
(
1
,
0
,
size
/
2
);
}
else
{
offsetValue
=
polygonGeometry
.
_offsetAttribute
===
GeometryOffsetAttribute_default
.
NONE
?
0
:
1
;
offsetAttribute
=
offsetAttribute
.
fill
(
offsetValue
);
}
geometryInstance
.
geometry
.
attributes
.
applyOffset
=
new
GeometryAttribute_default
(
{
componentDatatype
:
ComponentDatatype_default
.
UNSIGNED_BYTE
,
componentsPerAttribute
:
1
,
values
:
offsetAttribute
}
);
}
geometries
.
push
(
geometryInstance
);
}
}
else
{
for
(
i
=
0
;
i
<
polygons
.
length
;
i
++
)
{
geometryInstance
=
createGeometryFromPositions
(
ellipsoid
,
polygons
[
i
],
minDistance
,
perPositionHeight
,
arcType
);
geometryInstance
.
geometry
.
attributes
.
position
.
values
=
PolygonPipeline_default
.
scaleToGeodeticHeight
(
geometryInstance
.
geometry
.
attributes
.
position
.
values
,
height
,
ellipsoid
,
!
perPositionHeight
);
if
(
defined_default
(
polygonGeometry
.
_offsetAttribute
))
{
const
length
=
geometryInstance
.
geometry
.
attributes
.
position
.
values
.
length
;
offsetValue
=
polygonGeometry
.
_offsetAttribute
===
GeometryOffsetAttribute_default
.
NONE
?
0
:
1
;
const
applyOffset
=
new
Uint8Array
(
length
/
3
).
fill
(
offsetValue
);
geometryInstance
.
geometry
.
attributes
.
applyOffset
=
new
GeometryAttribute_default
(
{
componentDatatype
:
ComponentDatatype_default
.
UNSIGNED_BYTE
,
componentsPerAttribute
:
1
,
values
:
applyOffset
}
);
}
geometries
.
push
(
geometryInstance
);
}
}
const
geometry
=
GeometryPipeline_default
.
combineInstances
(
geometries
)[
0
];
const
boundingSphere
=
BoundingSphere_default
.
fromVertices
(
geometry
.
attributes
.
position
.
values
);
return
new
Geometry_default
({
attributes
:
geometry
.
attributes
,
indices
:
geometry
.
indices
,
primitiveType
:
geometry
.
primitiveType
,
boundingSphere
,
offsetAttribute
:
polygonGeometry
.
_offsetAttribute
});
};
var
PolygonOutlineGeometry_default
=
PolygonOutlineGeometry
;
// packages/engine/Source/Workers/createPolygonOutlineGeometry.js
function
createPolygonOutlineGeometry
(
polygonGeometry
,
offset
)
{
if
(
defined_default
(
offset
))
{
polygonGeometry
=
PolygonOutlineGeometry_default
.
unpack
(
polygonGeometry
,
offset
);
}
polygonGeometry
.
_ellipsoid
=
Ellipsoid_default
.
clone
(
polygonGeometry
.
_ellipsoid
);
return
PolygonOutlineGeometry_default
.
createGeometry
(
polygonGeometry
);
}
var
createPolygonOutlineGeometry_default
=
createPolygonOutlineGeometry
;
export
{
createPolygonOutlineGeometry_default
as
default
};
public/assets/cesium/Workers/createPolylineGeometry.js
0 → 100644
View file @
155e1be1
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import
{
Color_default
}
from
"
./chunk-HP5XLODI.js
"
;
import
{
ArcType_default
}
from
"
./chunk-XWOUPGUF.js
"
;
import
{
PolylinePipeline_default
}
from
"
./chunk-QN6TBED4.js
"
;
import
"
./chunk-C3EQ27WF.js
"
;
import
{
VertexFormat_default
}
from
"
./chunk-JBSKHTNX.js
"
;
import
{
arrayRemoveDuplicates_default
}
from
"
./chunk-57H6I3SV.js
"
;
import
"
./chunk-JSQJDZI4.js
"
;
import
"
./chunk-QQOZO7KO.js
"
;
import
"
./chunk-EDLRS3AW.js
"
;
import
{
IndexDatatype_default
}
from
"
./chunk-C4WPMOKT.js
"
;
import
{
GeometryAttributes_default
}
from
"
./chunk-X7IQYYHF.js
"
;
import
{
GeometryAttribute_default
,
GeometryType_default
,
Geometry_default
,
PrimitiveType_default
}
from
"
./chunk-JXVLNVXC.js
"
;
import
{
BoundingSphere_default
}
from
"
./chunk-KHZNBFOH.js
"
;
import
"
./chunk-6SQMLVGV.js
"
;
import
{
ComponentDatatype_default
}
from
"
./chunk-XIUSRWL6.js
"
;
import
{
Cartesian3_default
,
Ellipsoid_default
}
from
"
./chunk-FFLMY4TE.js
"
;
import
{
Math_default
}
from
"
./chunk-WGDFYAGC.js
"
;
import
"
./chunk-3HQMMUPU.js
"
;
import
"
./chunk-LLAF3CPH.js
"
;
import
{
defaultValue_default
}
from
"
./chunk-U5HSOKPQ.js
"
;
import
{
DeveloperError_default
}
from
"
./chunk-P6TRGU3S.js
"
;
import
{
defined_default
}
from
"
./chunk-YCDZX5LS.js
"
;
// packages/engine/Source/Core/PolylineGeometry.js
var
scratchInterpolateColorsArray
=
[];
function
interpolateColors
(
p0
,
p1
,
color0
,
color1
,
numPoints
)
{
const
colors
=
scratchInterpolateColorsArray
;
colors
.
length
=
numPoints
;
let
i
;
const
r0
=
color0
.
red
;
const
g0
=
color0
.
green
;
const
b0
=
color0
.
blue
;
const
a0
=
color0
.
alpha
;
const
r1
=
color1
.
red
;
const
g1
=
color1
.
green
;
const
b1
=
color1
.
blue
;
const
a1
=
color1
.
alpha
;
if
(
Color_default
.
equals
(
color0
,
color1
))
{
for
(
i
=
0
;
i
<
numPoints
;
i
++
)
{
colors
[
i
]
=
Color_default
.
clone
(
color0
);
}
return
colors
;
}
const
redPerVertex
=
(
r1
-
r0
)
/
numPoints
;
const
greenPerVertex
=
(
g1
-
g0
)
/
numPoints
;
const
bluePerVertex
=
(
b1
-
b0
)
/
numPoints
;
const
alphaPerVertex
=
(
a1
-
a0
)
/
numPoints
;
for
(
i
=
0
;
i
<
numPoints
;
i
++
)
{
colors
[
i
]
=
new
Color_default
(
r0
+
i
*
redPerVertex
,
g0
+
i
*
greenPerVertex
,
b0
+
i
*
bluePerVertex
,
a0
+
i
*
alphaPerVertex
);
}
return
colors
;
}
function
PolylineGeometry
(
options
)
{
options
=
defaultValue_default
(
options
,
defaultValue_default
.
EMPTY_OBJECT
);
const
positions
=
options
.
positions
;
const
colors
=
options
.
colors
;
const
width
=
defaultValue_default
(
options
.
width
,
1
);
const
colorsPerVertex
=
defaultValue_default
(
options
.
colorsPerVertex
,
false
);
if
(
!
defined_default
(
positions
)
||
positions
.
length
<
2
)
{
throw
new
DeveloperError_default
(
"
At least two positions are required.
"
);
}
if
(
typeof
width
!==
"
number
"
)
{
throw
new
DeveloperError_default
(
"
width must be a number
"
);
}
if
(
defined_default
(
colors
)
&&
(
colorsPerVertex
&&
colors
.
length
<
positions
.
length
||
!
colorsPerVertex
&&
colors
.
length
<
positions
.
length
-
1
))
{
throw
new
DeveloperError_default
(
"
colors has an invalid length.
"
);
}
this
.
_positions
=
positions
;
this
.
_colors
=
colors
;
this
.
_width
=
width
;
this
.
_colorsPerVertex
=
colorsPerVertex
;
this
.
_vertexFormat
=
VertexFormat_default
.
clone
(
defaultValue_default
(
options
.
vertexFormat
,
VertexFormat_default
.
DEFAULT
)
);
this
.
_arcType
=
defaultValue_default
(
options
.
arcType
,
ArcType_default
.
GEODESIC
);
this
.
_granularity
=
defaultValue_default
(
options
.
granularity
,
Math_default
.
RADIANS_PER_DEGREE
);
this
.
_ellipsoid
=
Ellipsoid_default
.
clone
(
defaultValue_default
(
options
.
ellipsoid
,
Ellipsoid_default
.
default
)
);
this
.
_workerName
=
"
createPolylineGeometry
"
;
let
numComponents
=
1
+
positions
.
length
*
Cartesian3_default
.
packedLength
;
numComponents
+=
defined_default
(
colors
)
?
1
+
colors
.
length
*
Color_default
.
packedLength
:
1
;
this
.
packedLength
=
numComponents
+
Ellipsoid_default
.
packedLength
+
VertexFormat_default
.
packedLength
+
4
;
}
PolylineGeometry
.
pack
=
function
(
value
,
array
,
startingIndex
)
{
if
(
!
defined_default
(
value
))
{
throw
new
DeveloperError_default
(
"
value is required
"
);
}
if
(
!
defined_default
(
array
))
{
throw
new
DeveloperError_default
(
"
array is required
"
);
}
startingIndex
=
defaultValue_default
(
startingIndex
,
0
);
let
i
;
const
positions
=
value
.
_positions
;
let
length
=
positions
.
length
;
array
[
startingIndex
++
]
=
length
;
for
(
i
=
0
;
i
<
length
;
++
i
,
startingIndex
+=
Cartesian3_default
.
packedLength
)
{
Cartesian3_default
.
pack
(
positions
[
i
],
array
,
startingIndex
);
}
const
colors
=
value
.
_colors
;
length
=
defined_default
(
colors
)
?
colors
.
length
:
0
;
array
[
startingIndex
++
]
=
length
;
for
(
i
=
0
;
i
<
length
;
++
i
,
startingIndex
+=
Color_default
.
packedLength
)
{
Color_default
.
pack
(
colors
[
i
],
array
,
startingIndex
);
}
Ellipsoid_default
.
pack
(
value
.
_ellipsoid
,
array
,
startingIndex
);
startingIndex
+=
Ellipsoid_default
.
packedLength
;
VertexFormat_default
.
pack
(
value
.
_vertexFormat
,
array
,
startingIndex
);
startingIndex
+=
VertexFormat_default
.
packedLength
;
array
[
startingIndex
++
]
=
value
.
_width
;
array
[
startingIndex
++
]
=
value
.
_colorsPerVertex
?
1
:
0
;
array
[
startingIndex
++
]
=
value
.
_arcType
;
array
[
startingIndex
]
=
value
.
_granularity
;
return
array
;
};
var
scratchEllipsoid
=
Ellipsoid_default
.
clone
(
Ellipsoid_default
.
UNIT_SPHERE
);
var
scratchVertexFormat
=
new
VertexFormat_default
();
var
scratchOptions
=
{
positions
:
void
0
,
colors
:
void
0
,
ellipsoid
:
scratchEllipsoid
,
vertexFormat
:
scratchVertexFormat
,
width
:
void
0
,
colorsPerVertex
:
void
0
,
arcType
:
void
0
,
granularity
:
void
0
};
PolylineGeometry
.
unpack
=
function
(
array
,
startingIndex
,
result
)
{
if
(
!
defined_default
(
array
))
{
throw
new
DeveloperError_default
(
"
array is required
"
);
}
startingIndex
=
defaultValue_default
(
startingIndex
,
0
);
let
i
;
let
length
=
array
[
startingIndex
++
];
const
positions
=
new
Array
(
length
);
for
(
i
=
0
;
i
<
length
;
++
i
,
startingIndex
+=
Cartesian3_default
.
packedLength
)
{
positions
[
i
]
=
Cartesian3_default
.
unpack
(
array
,
startingIndex
);
}
length
=
array
[
startingIndex
++
];
const
colors
=
length
>
0
?
new
Array
(
length
)
:
void
0
;
for
(
i
=
0
;
i
<
length
;
++
i
,
startingIndex
+=
Color_default
.
packedLength
)
{
colors
[
i
]
=
Color_default
.
unpack
(
array
,
startingIndex
);
}
const
ellipsoid
=
Ellipsoid_default
.
unpack
(
array
,
startingIndex
,
scratchEllipsoid
);
startingIndex
+=
Ellipsoid_default
.
packedLength
;
const
vertexFormat
=
VertexFormat_default
.
unpack
(
array
,
startingIndex
,
scratchVertexFormat
);
startingIndex
+=
VertexFormat_default
.
packedLength
;
const
width
=
array
[
startingIndex
++
];
const
colorsPerVertex
=
array
[
startingIndex
++
]
===
1
;
const
arcType
=
array
[
startingIndex
++
];
const
granularity
=
array
[
startingIndex
];
if
(
!
defined_default
(
result
))
{
scratchOptions
.
positions
=
positions
;
scratchOptions
.
colors
=
colors
;
scratchOptions
.
width
=
width
;
scratchOptions
.
colorsPerVertex
=
colorsPerVertex
;
scratchOptions
.
arcType
=
arcType
;
scratchOptions
.
granularity
=
granularity
;
return
new
PolylineGeometry
(
scratchOptions
);
}
result
.
_positions
=
positions
;
result
.
_colors
=
colors
;
result
.
_ellipsoid
=
Ellipsoid_default
.
clone
(
ellipsoid
,
result
.
_ellipsoid
);
result
.
_vertexFormat
=
VertexFormat_default
.
clone
(
vertexFormat
,
result
.
_vertexFormat
);
result
.
_width
=
width
;
result
.
_colorsPerVertex
=
colorsPerVertex
;
result
.
_arcType
=
arcType
;
result
.
_granularity
=
granularity
;
return
result
;
};
var
scratchCartesian3
=
new
Cartesian3_default
();
var
scratchPosition
=
new
Cartesian3_default
();
var
scratchPrevPosition
=
new
Cartesian3_default
();
var
scratchNextPosition
=
new
Cartesian3_default
();
PolylineGeometry
.
createGeometry
=
function
(
polylineGeometry
)
{
const
width
=
polylineGeometry
.
_width
;
const
vertexFormat
=
polylineGeometry
.
_vertexFormat
;
let
colors
=
polylineGeometry
.
_colors
;
const
colorsPerVertex
=
polylineGeometry
.
_colorsPerVertex
;
const
arcType
=
polylineGeometry
.
_arcType
;
const
granularity
=
polylineGeometry
.
_granularity
;
const
ellipsoid
=
polylineGeometry
.
_ellipsoid
;
let
i
;
let
j
;
let
k
;
const
removedIndices
=
[];
let
positions
=
arrayRemoveDuplicates_default
(
polylineGeometry
.
_positions
,
Cartesian3_default
.
equalsEpsilon
,
false
,
removedIndices
);
if
(
defined_default
(
colors
)
&&
removedIndices
.
length
>
0
)
{
let
removedArrayIndex
=
0
;
let
nextRemovedIndex
=
removedIndices
[
0
];
colors
=
colors
.
filter
(
function
(
color
,
index2
)
{
let
remove
=
false
;
if
(
colorsPerVertex
)
{
remove
=
index2
===
nextRemovedIndex
||
index2
===
0
&&
nextRemovedIndex
===
1
;
}
else
{
remove
=
index2
+
1
===
nextRemovedIndex
;
}
if
(
remove
)
{
removedArrayIndex
++
;
nextRemovedIndex
=
removedIndices
[
removedArrayIndex
];
return
false
;
}
return
true
;
});
}
let
positionsLength
=
positions
.
length
;
if
(
positionsLength
<
2
||
width
<=
0
)
{
return
void
0
;
}
if
(
arcType
===
ArcType_default
.
GEODESIC
||
arcType
===
ArcType_default
.
RHUMB
)
{
let
subdivisionSize
;
let
numberOfPointsFunction
;
if
(
arcType
===
ArcType_default
.
GEODESIC
)
{
subdivisionSize
=
Math_default
.
chordLength
(
granularity
,
ellipsoid
.
maximumRadius
);
numberOfPointsFunction
=
PolylinePipeline_default
.
numberOfPoints
;
}
else
{
subdivisionSize
=
granularity
;
numberOfPointsFunction
=
PolylinePipeline_default
.
numberOfPointsRhumbLine
;
}
const
heights
=
PolylinePipeline_default
.
extractHeights
(
positions
,
ellipsoid
);
if
(
defined_default
(
colors
))
{
let
colorLength
=
1
;
for
(
i
=
0
;
i
<
positionsLength
-
1
;
++
i
)
{
colorLength
+=
numberOfPointsFunction
(
positions
[
i
],
positions
[
i
+
1
],
subdivisionSize
);
}
const
newColors
=
new
Array
(
colorLength
);
let
newColorIndex
=
0
;
for
(
i
=
0
;
i
<
positionsLength
-
1
;
++
i
)
{
const
p0
=
positions
[
i
];
const
p1
=
positions
[
i
+
1
];
const
c0
=
colors
[
i
];
const
numColors
=
numberOfPointsFunction
(
p0
,
p1
,
subdivisionSize
);
if
(
colorsPerVertex
&&
i
<
colorLength
)
{
const
c1
=
colors
[
i
+
1
];
const
interpolatedColors
=
interpolateColors
(
p0
,
p1
,
c0
,
c1
,
numColors
);
const
interpolatedColorsLength
=
interpolatedColors
.
length
;
for
(
j
=
0
;
j
<
interpolatedColorsLength
;
++
j
)
{
newColors
[
newColorIndex
++
]
=
interpolatedColors
[
j
];
}
}
else
{
for
(
j
=
0
;
j
<
numColors
;
++
j
)
{
newColors
[
newColorIndex
++
]
=
Color_default
.
clone
(
c0
);
}
}
}
newColors
[
newColorIndex
]
=
Color_default
.
clone
(
colors
[
colors
.
length
-
1
]);
colors
=
newColors
;
scratchInterpolateColorsArray
.
length
=
0
;
}
if
(
arcType
===
ArcType_default
.
GEODESIC
)
{
positions
=
PolylinePipeline_default
.
generateCartesianArc
({
positions
,
minDistance
:
subdivisionSize
,
ellipsoid
,
height
:
heights
});
}
else
{
positions
=
PolylinePipeline_default
.
generateCartesianRhumbArc
({
positions
,
granularity
:
subdivisionSize
,
ellipsoid
,
height
:
heights
});
}
}
positionsLength
=
positions
.
length
;
const
size
=
positionsLength
*
4
-
4
;
const
finalPositions
=
new
Float64Array
(
size
*
3
);
const
prevPositions
=
new
Float64Array
(
size
*
3
);
const
nextPositions
=
new
Float64Array
(
size
*
3
);
const
expandAndWidth
=
new
Float32Array
(
size
*
2
);
const
st
=
vertexFormat
.
st
?
new
Float32Array
(
size
*
2
)
:
void
0
;
const
finalColors
=
defined_default
(
colors
)
?
new
Uint8Array
(
size
*
4
)
:
void
0
;
let
positionIndex
=
0
;
let
expandAndWidthIndex
=
0
;
let
stIndex
=
0
;
let
colorIndex
=
0
;
let
position
;
for
(
j
=
0
;
j
<
positionsLength
;
++
j
)
{
if
(
j
===
0
)
{
position
=
scratchCartesian3
;
Cartesian3_default
.
subtract
(
positions
[
0
],
positions
[
1
],
position
);
Cartesian3_default
.
add
(
positions
[
0
],
position
,
position
);
}
else
{
position
=
positions
[
j
-
1
];
}
Cartesian3_default
.
clone
(
position
,
scratchPrevPosition
);
Cartesian3_default
.
clone
(
positions
[
j
],
scratchPosition
);
if
(
j
===
positionsLength
-
1
)
{
position
=
scratchCartesian3
;
Cartesian3_default
.
subtract
(
positions
[
positionsLength
-
1
],
positions
[
positionsLength
-
2
],
position
);
Cartesian3_default
.
add
(
positions
[
positionsLength
-
1
],
position
,
position
);
}
else
{
position
=
positions
[
j
+
1
];
}
Cartesian3_default
.
clone
(
position
,
scratchNextPosition
);
let
color0
,
color1
;
if
(
defined_default
(
finalColors
))
{
if
(
j
!==
0
&&
!
colorsPerVertex
)
{
color0
=
colors
[
j
-
1
];
}
else
{
color0
=
colors
[
j
];
}
if
(
j
!==
positionsLength
-
1
)
{
color1
=
colors
[
j
];
}
}
const
startK
=
j
===
0
?
2
:
0
;
const
endK
=
j
===
positionsLength
-
1
?
2
:
4
;
for
(
k
=
startK
;
k
<
endK
;
++
k
)
{
Cartesian3_default
.
pack
(
scratchPosition
,
finalPositions
,
positionIndex
);
Cartesian3_default
.
pack
(
scratchPrevPosition
,
prevPositions
,
positionIndex
);
Cartesian3_default
.
pack
(
scratchNextPosition
,
nextPositions
,
positionIndex
);
positionIndex
+=
3
;
const
direction
=
k
-
2
<
0
?
-
1
:
1
;
expandAndWidth
[
expandAndWidthIndex
++
]
=
2
*
(
k
%
2
)
-
1
;
expandAndWidth
[
expandAndWidthIndex
++
]
=
direction
*
width
;
if
(
vertexFormat
.
st
)
{
st
[
stIndex
++
]
=
j
/
(
positionsLength
-
1
);
st
[
stIndex
++
]
=
Math
.
max
(
expandAndWidth
[
expandAndWidthIndex
-
2
],
0
);
}
if
(
defined_default
(
finalColors
))
{
const
color
=
k
<
2
?
color0
:
color1
;
finalColors
[
colorIndex
++
]
=
Color_default
.
floatToByte
(
color
.
red
);
finalColors
[
colorIndex
++
]
=
Color_default
.
floatToByte
(
color
.
green
);
finalColors
[
colorIndex
++
]
=
Color_default
.
floatToByte
(
color
.
blue
);
finalColors
[
colorIndex
++
]
=
Color_default
.
floatToByte
(
color
.
alpha
);
}
}
}
const
attributes
=
new
GeometryAttributes_default
();
attributes
.
position
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
DOUBLE
,
componentsPerAttribute
:
3
,
values
:
finalPositions
});
attributes
.
prevPosition
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
DOUBLE
,
componentsPerAttribute
:
3
,
values
:
prevPositions
});
attributes
.
nextPosition
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
DOUBLE
,
componentsPerAttribute
:
3
,
values
:
nextPositions
});
attributes
.
expandAndWidth
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
FLOAT
,
componentsPerAttribute
:
2
,
values
:
expandAndWidth
});
if
(
vertexFormat
.
st
)
{
attributes
.
st
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
FLOAT
,
componentsPerAttribute
:
2
,
values
:
st
});
}
if
(
defined_default
(
finalColors
))
{
attributes
.
color
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
UNSIGNED_BYTE
,
componentsPerAttribute
:
4
,
values
:
finalColors
,
normalize
:
true
});
}
const
indices
=
IndexDatatype_default
.
createTypedArray
(
size
,
positionsLength
*
6
-
6
);
let
index
=
0
;
let
indicesIndex
=
0
;
const
length
=
positionsLength
-
1
;
for
(
j
=
0
;
j
<
length
;
++
j
)
{
indices
[
indicesIndex
++
]
=
index
;
indices
[
indicesIndex
++
]
=
index
+
2
;
indices
[
indicesIndex
++
]
=
index
+
1
;
indices
[
indicesIndex
++
]
=
index
+
1
;
indices
[
indicesIndex
++
]
=
index
+
2
;
indices
[
indicesIndex
++
]
=
index
+
3
;
index
+=
4
;
}
return
new
Geometry_default
({
attributes
,
indices
,
primitiveType
:
PrimitiveType_default
.
TRIANGLES
,
boundingSphere
:
BoundingSphere_default
.
fromPoints
(
positions
),
geometryType
:
GeometryType_default
.
POLYLINES
});
};
var
PolylineGeometry_default
=
PolylineGeometry
;
// packages/engine/Source/Workers/createPolylineGeometry.js
function
createPolylineGeometry
(
polylineGeometry
,
offset
)
{
if
(
defined_default
(
offset
))
{
polylineGeometry
=
PolylineGeometry_default
.
unpack
(
polylineGeometry
,
offset
);
}
polylineGeometry
.
_ellipsoid
=
Ellipsoid_default
.
clone
(
polylineGeometry
.
_ellipsoid
);
return
PolylineGeometry_default
.
createGeometry
(
polylineGeometry
);
}
var
createPolylineGeometry_default
=
createPolylineGeometry
;
export
{
createPolylineGeometry_default
as
default
};
public/assets/cesium/Workers/createPolylineVolumeGeometry.js
0 → 100644
View file @
155e1be1
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import
{
BoundingRectangle_default
}
from
"
./chunk-44QAAS4P.js
"
;
import
{
GeometryPipeline_default
}
from
"
./chunk-7ZZ5LMZY.js
"
;
import
"
./chunk-LJ2JQHJT.js
"
;
import
"
./chunk-NGZJIN5Z.js
"
;
import
{
CornerType_default
,
PolylineVolumeGeometryLibrary_default
,
oneTimeWarning_default
}
from
"
./chunk-3IFRSGEY.js
"
;
import
"
./chunk-QN6TBED4.js
"
;
import
"
./chunk-C3EQ27WF.js
"
;
import
{
VertexFormat_default
}
from
"
./chunk-JBSKHTNX.js
"
;
import
"
./chunk-YK3QIKY7.js
"
;
import
"
./chunk-NDDI2LWR.js
"
;
import
{
PolygonPipeline_default
,
WindingOrder_default
}
from
"
./chunk-TI3TRKIC.js
"
;
import
{
arrayRemoveDuplicates_default
}
from
"
./chunk-57H6I3SV.js
"
;
import
"
./chunk-JSQJDZI4.js
"
;
import
"
./chunk-QQOZO7KO.js
"
;
import
"
./chunk-EDLRS3AW.js
"
;
import
{
IndexDatatype_default
}
from
"
./chunk-C4WPMOKT.js
"
;
import
{
GeometryAttributes_default
}
from
"
./chunk-X7IQYYHF.js
"
;
import
{
GeometryAttribute_default
,
Geometry_default
,
PrimitiveType_default
}
from
"
./chunk-JXVLNVXC.js
"
;
import
{
BoundingSphere_default
}
from
"
./chunk-KHZNBFOH.js
"
;
import
"
./chunk-6SQMLVGV.js
"
;
import
{
ComponentDatatype_default
}
from
"
./chunk-XIUSRWL6.js
"
;
import
{
Cartesian2_default
,
Cartesian3_default
,
Ellipsoid_default
}
from
"
./chunk-FFLMY4TE.js
"
;
import
{
Math_default
}
from
"
./chunk-WGDFYAGC.js
"
;
import
"
./chunk-3HQMMUPU.js
"
;
import
"
./chunk-LLAF3CPH.js
"
;
import
{
defaultValue_default
}
from
"
./chunk-U5HSOKPQ.js
"
;
import
{
DeveloperError_default
}
from
"
./chunk-P6TRGU3S.js
"
;
import
{
defined_default
}
from
"
./chunk-YCDZX5LS.js
"
;
// packages/engine/Source/Core/PolylineVolumeGeometry.js
function
computeAttributes
(
combinedPositions
,
shape
,
boundingRectangle
,
vertexFormat
)
{
const
attributes
=
new
GeometryAttributes_default
();
if
(
vertexFormat
.
position
)
{
attributes
.
position
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
DOUBLE
,
componentsPerAttribute
:
3
,
values
:
combinedPositions
});
}
const
shapeLength
=
shape
.
length
;
const
vertexCount
=
combinedPositions
.
length
/
3
;
const
length
=
(
vertexCount
-
shapeLength
*
2
)
/
(
shapeLength
*
2
);
const
firstEndIndices
=
PolygonPipeline_default
.
triangulate
(
shape
);
const
indicesCount
=
(
length
-
1
)
*
shapeLength
*
6
+
firstEndIndices
.
length
*
2
;
const
indices
=
IndexDatatype_default
.
createTypedArray
(
vertexCount
,
indicesCount
);
let
i
,
j
;
let
ll
,
ul
,
ur
,
lr
;
const
offset
=
shapeLength
*
2
;
let
index
=
0
;
for
(
i
=
0
;
i
<
length
-
1
;
i
++
)
{
for
(
j
=
0
;
j
<
shapeLength
-
1
;
j
++
)
{
ll
=
j
*
2
+
i
*
shapeLength
*
2
;
lr
=
ll
+
offset
;
ul
=
ll
+
1
;
ur
=
ul
+
offset
;
indices
[
index
++
]
=
ul
;
indices
[
index
++
]
=
ll
;
indices
[
index
++
]
=
ur
;
indices
[
index
++
]
=
ur
;
indices
[
index
++
]
=
ll
;
indices
[
index
++
]
=
lr
;
}
ll
=
shapeLength
*
2
-
2
+
i
*
shapeLength
*
2
;
ul
=
ll
+
1
;
ur
=
ul
+
offset
;
lr
=
ll
+
offset
;
indices
[
index
++
]
=
ul
;
indices
[
index
++
]
=
ll
;
indices
[
index
++
]
=
ur
;
indices
[
index
++
]
=
ur
;
indices
[
index
++
]
=
ll
;
indices
[
index
++
]
=
lr
;
}
if
(
vertexFormat
.
st
||
vertexFormat
.
tangent
||
vertexFormat
.
bitangent
)
{
const
st
=
new
Float32Array
(
vertexCount
*
2
);
const
lengthSt
=
1
/
(
length
-
1
);
const
heightSt
=
1
/
boundingRectangle
.
height
;
const
heightOffset
=
boundingRectangle
.
height
/
2
;
let
s
,
t
;
let
stindex
=
0
;
for
(
i
=
0
;
i
<
length
;
i
++
)
{
s
=
i
*
lengthSt
;
t
=
heightSt
*
(
shape
[
0
].
y
+
heightOffset
);
st
[
stindex
++
]
=
s
;
st
[
stindex
++
]
=
t
;
for
(
j
=
1
;
j
<
shapeLength
;
j
++
)
{
t
=
heightSt
*
(
shape
[
j
].
y
+
heightOffset
);
st
[
stindex
++
]
=
s
;
st
[
stindex
++
]
=
t
;
st
[
stindex
++
]
=
s
;
st
[
stindex
++
]
=
t
;
}
t
=
heightSt
*
(
shape
[
0
].
y
+
heightOffset
);
st
[
stindex
++
]
=
s
;
st
[
stindex
++
]
=
t
;
}
for
(
j
=
0
;
j
<
shapeLength
;
j
++
)
{
s
=
0
;
t
=
heightSt
*
(
shape
[
j
].
y
+
heightOffset
);
st
[
stindex
++
]
=
s
;
st
[
stindex
++
]
=
t
;
}
for
(
j
=
0
;
j
<
shapeLength
;
j
++
)
{
s
=
(
length
-
1
)
*
lengthSt
;
t
=
heightSt
*
(
shape
[
j
].
y
+
heightOffset
);
st
[
stindex
++
]
=
s
;
st
[
stindex
++
]
=
t
;
}
attributes
.
st
=
new
GeometryAttribute_default
({
componentDatatype
:
ComponentDatatype_default
.
FLOAT
,
componentsPerAttribute
:
2
,
values
:
new
Float32Array
(
st
)
});
}
const
endOffset
=
vertexCount
-
shapeLength
*
2
;
for
(
i
=
0
;
i
<
firstEndIndices
.
length
;
i
+=
3
)
{
const
v0
=
firstEndIndices
[
i
]
+
endOffset
;
const
v1
=
firstEndIndices
[
i
+
1
]
+
endOffset
;
const
v2
=
firstEndIndices
[
i
+
2
]
+
endOffset
;
indices
[
index
++
]
=
v0
;
indices
[
index
++
]
=
v1
;
indices
[
index
++
]
=
v2
;
indices
[
index
++
]
=
v2
+
shapeLength
;
indices
[
index
++
]
=
v1
+
shapeLength
;
indices
[
index
++
]
=
v0
+
shapeLength
;
}
let
geometry
=
new
Geometry_default
({
attributes
,
indices
,
boundingSphere
:
BoundingSphere_default
.
fromVertices
(
combinedPositions
),
primitiveType
:
PrimitiveType_default
.
TRIANGLES
});
if
(
vertexFormat
.
normal
)
{
geometry
=
GeometryPipeline_default
.
computeNormal
(
geometry
);
}
if
(
vertexFormat
.
tangent
||
vertexFormat
.
bitangent
)
{
try
{
geometry
=
GeometryPipeline_default
.
computeTangentAndBitangent
(
geometry
);
}
catch
(
e
)
{
oneTimeWarning_default
(
"
polyline-volume-tangent-bitangent
"
,
"
Unable to compute tangents and bitangents for polyline volume geometry
"
);
}
if
(
!
vertexFormat
.
tangent
)
{
geometry
.
attributes
.
tangent
=
void
0
;
}
if
(
!
vertexFormat
.
bitangent
)
{
geometry
.
attributes
.
bitangent
=
void
0
;
}
if
(
!
vertexFormat
.
st
)
{
geometry
.
attributes
.
st
=
void
0
;
}
}
return
geometry
;
}
function
PolylineVolumeGeometry
(
options
)
{
options
=
defaultValue_default
(
options
,
defaultValue_default
.
EMPTY_OBJECT
);
const
positions
=
options
.
polylinePositions
;
const
shape
=
options
.
shapePositions
;
if
(
!
defined_default
(
positions
))
{
throw
new
DeveloperError_default
(
"
options.polylinePositions is required.
"
);
}
if
(
!
defined_default
(
shape
))
{
throw
new
DeveloperError_default
(
"
options.shapePositions is required.
"
);
}
this
.
_positions
=
positions
;
this
.
_shape
=
shape
;
this
.
_ellipsoid
=
Ellipsoid_default
.
clone
(
defaultValue_default
(
options
.
ellipsoid
,
Ellipsoid_default
.
default
)
);
this
.
_cornerType
=
defaultValue_default
(
options
.
cornerType
,
CornerType_default
.
ROUNDED
);
this
.
_vertexFormat
=
VertexFormat_default
.
clone
(
defaultValue_default
(
options
.
vertexFormat
,
VertexFormat_default
.
DEFAULT
)
);
this
.
_granularity
=
defaultValue_default
(
options
.
granularity
,
Math_default
.
RADIANS_PER_DEGREE
);
this
.
_workerName
=
"
createPolylineVolumeGeometry
"
;
let
numComponents
=
1
+
positions
.
length
*
Cartesian3_default
.
packedLength
;
numComponents
+=
1
+
shape
.
length
*
Cartesian2_default
.
packedLength
;
this
.
packedLength
=
numComponents
+
Ellipsoid_default
.
packedLength
+
VertexFormat_default
.
packedLength
+
2
;
}
PolylineVolumeGeometry
.
pack
=
function
(
value
,
array
,
startingIndex
)
{
if
(
!
defined_default
(
value
))
{
throw
new
DeveloperError_default
(
"
value is required
"
);
}
if
(
!
defined_default
(
array
))
{
throw
new
DeveloperError_default
(
"
array is required
"
);
}
startingIndex
=
defaultValue_default
(
startingIndex
,
0
);
let
i
;
const
positions
=
value
.
_positions
;
let
length
=
positions
.
length
;
array
[
startingIndex
++
]
=
length
;
for
(
i
=
0
;
i
<
length
;
++
i
,
startingIndex
+=
Cartesian3_default
.
packedLength
)
{
Cartesian3_default
.
pack
(
positions
[
i
],
array
,
startingIndex
);
}
const
shape
=
value
.
_shape
;
length
=
shape
.
length
;
array
[
startingIndex
++
]
=
length
;
for
(
i
=
0
;
i
<
length
;
++
i
,
startingIndex
+=
Cartesian2_default
.
packedLength
)
{
Cartesian2_default
.
pack
(
shape
[
i
],
array
,
startingIndex
);
}
Ellipsoid_default
.
pack
(
value
.
_ellipsoid
,
array
,
startingIndex
);
startingIndex
+=
Ellipsoid_default
.
packedLength
;
VertexFormat_default
.
pack
(
value
.
_vertexFormat
,
array
,
startingIndex
);
startingIndex
+=
VertexFormat_default
.
packedLength
;
array
[
startingIndex
++
]
=
value
.
_cornerType
;
array
[
startingIndex
]
=
value
.
_granularity
;
return
array
;
};
var
scratchEllipsoid
=
Ellipsoid_default
.
clone
(
Ellipsoid_default
.
UNIT_SPHERE
);
var
scratchVertexFormat
=
new
VertexFormat_default
();
var
scratchOptions
=
{
polylinePositions
:
void
0
,
shapePositions
:
void
0
,
ellipsoid
:
scratchEllipsoid
,
vertexFormat
:
scratchVertexFormat
,
cornerType
:
void
0
,
granularity
:
void
0
};
PolylineVolumeGeometry
.
unpack
=
function
(
array
,
startingIndex
,
result
)
{
if
(
!
defined_default
(
array
))
{
throw
new
DeveloperError_default
(
"
array is required
"
);
}
startingIndex
=
defaultValue_default
(
startingIndex
,
0
);
let
i
;
let
length
=
array
[
startingIndex
++
];
const
positions
=
new
Array
(
length
);
for
(
i
=
0
;
i
<
length
;
++
i
,
startingIndex
+=
Cartesian3_default
.
packedLength
)
{
positions
[
i
]
=
Cartesian3_default
.
unpack
(
array
,
startingIndex
);
}
length
=
array
[
startingIndex
++
];
const
shape
=
new
Array
(
length
);
for
(
i
=
0
;
i
<
length
;
++
i
,
startingIndex
+=
Cartesian2_default
.
packedLength
)
{
shape
[
i
]
=
Cartesian2_default
.
unpack
(
array
,
startingIndex
);
}
const
ellipsoid
=
Ellipsoid_default
.
unpack
(
array
,
startingIndex
,
scratchEllipsoid
);
startingIndex
+=
Ellipsoid_default
.
packedLength
;
const
vertexFormat
=
VertexFormat_default
.
unpack
(
array
,
startingIndex
,
scratchVertexFormat
);
startingIndex
+=
VertexFormat_default
.
packedLength
;
const
cornerType
=
array
[
startingIndex
++
];
const
granularity
=
array
[
startingIndex
];
if
(
!
defined_default
(
result
))
{
scratchOptions
.
polylinePositions
=
positions
;
scratchOptions
.
shapePositions
=
shape
;
scratchOptions
.
cornerType
=
cornerType
;
scratchOptions
.
granularity
=
granularity
;
return
new
PolylineVolumeGeometry
(
scratchOptions
);
}
result
.
_positions
=
positions
;
result
.
_shape
=
shape
;
result
.
_ellipsoid
=
Ellipsoid_default
.
clone
(
ellipsoid
,
result
.
_ellipsoid
);
result
.
_vertexFormat
=
VertexFormat_default
.
clone
(
vertexFormat
,
result
.
_vertexFormat
);
result
.
_cornerType
=
cornerType
;
result
.
_granularity
=
granularity
;
return
result
;
};
var
brScratch
=
new
BoundingRectangle_default
();
PolylineVolumeGeometry
.
createGeometry
=
function
(
polylineVolumeGeometry
)
{
const
positions
=
polylineVolumeGeometry
.
_positions
;
const
cleanPositions
=
arrayRemoveDuplicates_default
(
positions
,
Cartesian3_default
.
equalsEpsilon
);
let
shape2D
=
polylineVolumeGeometry
.
_shape
;
shape2D
=
PolylineVolumeGeometryLibrary_default
.
removeDuplicatesFromShape
(
shape2D
);
if
(
cleanPositions
.
length
<
2
||
shape2D
.
length
<
3
)
{
return
void
0
;
}
if
(
PolygonPipeline_default
.
computeWindingOrder2D
(
shape2D
)
===
WindingOrder_default
.
CLOCKWISE
)
{
shape2D
.
reverse
();
}
const
boundingRectangle
=
BoundingRectangle_default
.
fromPoints
(
shape2D
,
brScratch
);
const
computedPositions
=
PolylineVolumeGeometryLibrary_default
.
computePositions
(
cleanPositions
,
shape2D
,
boundingRectangle
,
polylineVolumeGeometry
,
true
);
return
computeAttributes
(
computedPositions
,
shape2D
,
boundingRectangle
,
polylineVolumeGeometry
.
_vertexFormat
);
};
var
PolylineVolumeGeometry_default
=
PolylineVolumeGeometry
;
// packages/engine/Source/Workers/createPolylineVolumeGeometry.js
function
createPolylineVolumeGeometry
(
polylineVolumeGeometry
,
offset
)
{
if
(
defined_default
(
offset
))
{
polylineVolumeGeometry
=
PolylineVolumeGeometry_default
.
unpack
(
polylineVolumeGeometry
,
offset
);
}
polylineVolumeGeometry
.
_ellipsoid
=
Ellipsoid_default
.
clone
(
polylineVolumeGeometry
.
_ellipsoid
);
return
PolylineVolumeGeometry_default
.
createGeometry
(
polylineVolumeGeometry
);
}
var
createPolylineVolumeGeometry_default
=
createPolylineVolumeGeometry
;
export
{
createPolylineVolumeGeometry_default
as
default
};
Prev
1
…
11
12
13
14
15
16
Next