/
VoxelShape.js
165 lines (150 loc) · 4.53 KB
/
VoxelShape.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
import DeveloperError from "../Core/DeveloperError.js";
/**
* Controls per-shape behavior for culling and rendering voxel grids.
* This type describes an interface and is not intended to be instantiated directly.
*
* @alias VoxelShape
* @constructor
*
* @see VoxelBoxShape
* @see VoxelEllipsoidShape
* @see VoxelCylinderShape
* @see VoxelShapeType
*
* @private
*/
function VoxelShape() {
DeveloperError.throwInstantiationError();
}
Object.defineProperties(VoxelShape.prototype, {
/**
* An oriented bounding box containing the bounded shape.
* The update function must be called before accessing this value.
*
* @memberof VoxelShape.prototype
* @type {OrientedBoundingBox}
* @readonly
*/
orientedBoundingBox: {
get: DeveloperError.throwInstantiationError,
},
/**
* A bounding sphere containing the bounded shape.
* The update function must be called before accessing this value.
*
* @memberof VoxelShape.prototype
* @type {BoundingSphere}
* @readonly
*/
boundingSphere: {
get: DeveloperError.throwInstantiationError,
},
/**
* A transformation matrix containing the bounded shape.
* The update function must be called before accessing this value.
*
* @memberof VoxelShape.prototype
* @type {Matrix4}
* @readonly
*/
boundTransform: {
get: DeveloperError.throwInstantiationError,
},
/**
* A transformation matrix containing the shape, ignoring the bounds.
* The update function must be called before accessing this value.
*
* @memberof VoxelShape.prototype
* @type {Matrix4}
* @readonly
*/
shapeTransform: {
get: DeveloperError.throwInstantiationError,
},
/**
* @type {Object<string, any>}
* @readonly
*/
shaderUniforms: {
get: DeveloperError.throwInstantiationError,
},
/**
* @type {Object<string, any>}
* @readonly
*/
shaderDefines: {
get: DeveloperError.throwInstantiationError,
},
/**
* The maximum number of intersections against the shape for any ray direction.
* @type {number}
* @readonly
*/
shaderMaximumIntersectionsLength: {
get: DeveloperError.throwInstantiationError,
},
});
/**
* Update the shape's state.
*
* @param {Matrix4} modelMatrix The model matrix.
* @param {Cartesian3} minBounds The minimum bounds.
* @param {Cartesian3} maxBounds The maximum bounds.
* @returns {boolean} Whether the shape is visible.
*/
VoxelShape.prototype.update = DeveloperError.throwInstantiationError;
/**
* Computes an oriented bounding box for a specified tile.
* The update function must be called before calling this function.
*
* @param {number} tileLevel The tile's level.
* @param {number} tileX The tile's x coordinate.
* @param {number} tileY The tile's y coordinate.
* @param {number} tileZ The tile's z coordinate.
* @param {OrientedBoundingBox} result The oriented bounding box that will be set to enclose the specified tile.
* @returns {OrientedBoundingBox} The oriented bounding box.
*/
VoxelShape.prototype.computeOrientedBoundingBoxForTile =
DeveloperError.throwInstantiationError;
/**
* Computes an oriented bounding box for a specified sample within a specified tile.
* The update function must be called before calling this function.
*
* @param {SpatialNode} spatialNode The spatial node containing the sample
* @param {Cartesian3} tileDimensions The size of the tile in number of samples, before padding
* @param {Cartesian3} tileUv The sample coordinate within the tile
* @param {OrientedBoundingBox} result The oriented bounding box that will be set to enclose the specified sample
* @returns {OrientedBoundingBox} The oriented bounding box.
*/
VoxelShape.prototype.computeOrientedBoundingBoxForSample =
DeveloperError.throwInstantiationError;
/**
* Computes an approximate step size for raymarching the root tile of a voxel grid.
* The update function must be called before calling this function.
*
* @param {Cartesian3} voxelDimensions The voxel grid dimensions for a tile.
* @returns {number} The step size.
*/
VoxelShape.prototype.computeApproximateStepSize =
DeveloperError.throwInstantiationError;
/**
* Defines the minimum bounds of the shape. The meaning can vary per-shape.
*
* @type {Cartesian3}
* @constant
* @readonly
*
* @private
*/
VoxelShape.DefaultMinBounds = DeveloperError.throwInstantiationError;
/**
* Defines the maximum bounds of the shape. The meaning can vary per-shape.
*
* @type {Cartesian3}
* @constant
* @readonly
*
* @private
*/
VoxelShape.DefaultMaxBounds = DeveloperError.throwInstantiationError;
export default VoxelShape;