@@ -92,14 +92,14 @@ public extension Geometry {
9292
9393 public init ( path: String , options: GeometryImporterOptions = . none) {
9494 let resourceManager = Game . unsafeShared. resourceManager
95- self . cacheKey = resourceManager. geometryCacheKey ( path: path, options: options)
95+ self . cacheKey = resourceManager. geometryCacheKey ( path: path, kind : . geometry , options: options)
9696 self . defaultCacheHint = . until( minutes: 5 )
9797 resourceManager. incrementReference ( self . cacheKey)
9898 }
9999
100100 internal init ( optionalRawGeometry rawGeometry: RawGeometry ? , immediate: Bool = false ) {
101101 let resourceManager = Game . unsafeShared. resourceManager
102- self . cacheKey = resourceManager. geometryCacheKey ( rawGeometry: rawGeometry, immediate: immediate)
102+ self . cacheKey = resourceManager. geometryCacheKey ( rawGeometry: rawGeometry, kind : . geometry , immediate: immediate)
103103 self . defaultCacheHint = . whileReferenced
104104 resourceManager. incrementReference ( self . cacheKey)
105105 }
@@ -206,7 +206,13 @@ extension RawGeometry {
206206extension ResourceManager . Cache {
207207 @usableFromInline
208208 struct GeometryKey : Hashable , Sendable , CustomStringConvertible {
209+ enum Kind : Hashable {
210+ case geometry
211+ case lines
212+ case points
213+ }
209214 let requestedPath : String
215+ let kind : Kind
210216 let geometryOptions : GeometryImporterOptions
211217
212218 @usableFromInline
@@ -248,8 +254,8 @@ extension ResourceManager {
248254 }
249255 }
250256
251- @MainActor func geometryCacheKey( path: String , options: GeometryImporterOptions ) -> Cache . GeometryKey {
252- let key = Cache . GeometryKey ( requestedPath: path, geometryOptions: options)
257+ @MainActor func geometryCacheKey( path: String , kind : Cache . GeometryKey . Kind , options: GeometryImporterOptions ) -> Cache . GeometryKey {
258+ let key = Cache . GeometryKey ( requestedPath: path, kind : kind , geometryOptions: options)
253259 if cache. geometries [ key] == nil {
254260 cache. geometries [ key] = Cache . GeometryCache ( )
255261 Game . unsafeShared. resourceManager. incrementLoading ( path: key. requestedPath)
@@ -282,9 +288,9 @@ extension ResourceManager {
282288 return key
283289 }
284290
285- @MainActor func geometryCacheKey( rawGeometry geometry: RawGeometry ? , immediate: Bool ) -> Cache . GeometryKey {
291+ @MainActor func geometryCacheKey( rawGeometry geometry: RawGeometry ? , kind : Cache . GeometryKey . Kind , immediate: Bool ) -> Cache . GeometryKey {
286292 let path = " $ \( rawCacheIDGenerator. generateID ( ) ) "
287- let key = Cache . GeometryKey ( requestedPath: path, geometryOptions: . none)
293+ let key = Cache . GeometryKey ( requestedPath: path, kind : kind , geometryOptions: . none)
288294 if cache. geometries [ key] == nil {
289295 cache. geometries [ key] = Cache . GeometryCache ( )
290296 if let geometry = geometry {
0 commit comments