simvx.core.resource¶
Resource system — URI-based resource resolution with caching.
Mesh resource identifiers: “mesh://cube” → Mesh.cube() “mesh://sphere?radius=2&rings=16” → Mesh.sphere(radius=2, rings=16) “mesh://obj?path=models/ship.obj” → Mesh.from_obj(“models/ship.obj”)
Audio resource identifiers: “audio://music/theme.ogg” → AudioStream(“music/theme.ogg”) “audio://sfx/explosion.wav” → AudioStream(“sfx/explosion.wav”)
Public API: ResourceCache.get().resolve_mesh(uri) ResourceCache.get().resolve_audio(uri)
Module Contents¶
Classes¶
Builder for mesh resource URIs. |
|
Singleton cache that resolves resource URIs to objects. |
API¶
- class simvx.core.resource.MeshURI¶
Builder for mesh resource URIs.
Usage: MeshURI.CUBE # “mesh://cube” MeshURI.SPHERE # “mesh://sphere” MeshURI.cube(size=0.5) # “mesh://cube?size=0.5” MeshURI.sphere(radius=2, rings=32) # “mesh://sphere?radius=2&rings=32” MeshURI.obj(“models/ship.obj”) # “mesh://obj?path=models/ship.obj”
- CUBE¶
‘mesh://cube’
- SPHERE¶
‘mesh://sphere’
- CONE¶
‘mesh://cone’
- CYLINDER¶
‘mesh://cylinder’
- static cube(size: float = 1.0) str¶
- static sphere(radius: float = 1.0, rings: int = 16, segments: int = 16) str¶
- static cone(radius: float = 0.5, height: float = 1.0, segments: int = 16) str¶
- static cylinder(radius: float = 0.5, height: float = 1.0, segments: int = 16) str¶
- static obj(path: str) str¶
- class simvx.core.resource.ResourceCache¶
Singleton cache that resolves resource URIs to objects.
Initialization
- classmethod get() simvx.core.resource.ResourceCache¶
Return the singleton instance, creating it if needed.
- resolve_mesh(uri: str) simvx.core.graphics.mesh.Mesh¶
Resolve a mesh:// URI to a Mesh object. Results are cached by URI.
- resolve_audio(uri: str) simvx.core.audio.AudioStream¶
Resolve an audio:// URI to an AudioStream object. Results are cached by URI.
- clear()¶
Clear all cached resources.
- classmethod reset()¶
Reset the singleton (useful for tests).