Skip to content

Add SplatViewer SOGS Compression #149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 5, 2025
Merged

Add SplatViewer SOGS Compression #149

merged 8 commits into from
Jun 5, 2025

Conversation

marklundin
Copy link
Member

@marklundin marklundin commented May 30, 2025

This PR adds support for SOGS compressed splats.

Example

import { Viewer } from '@playcanvas/blocks';
import meta from './meta.json' with { type: 'json' };

export const () => <Viewer.Splat src={meta} />

API changes

The src type now accepts a Sogs Meta type. It's a non breaking change

type SplatViewer = {
    src: string | Record<string, unknown>
    ...
}

The api makes no assumption about the actual data. it's entirely dependant on the engine implementation

image

@marklundin marklundin self-assigned this May 30, 2025
@marklundin marklundin added enhancement New feature or request Blocks labels May 30, 2025
Copy link

pkg-pr-new bot commented May 30, 2025

Open in StackBlitz

npm i https://pkg.pr.new/playcanvas/react/@playcanvas/react@149

commit: 6ec2b28

@marklundin marklundin changed the title Added support for SOGS Add support for SOGS May 30, 2025
…ype definitions

- Updated src type in AssetViewerProvider and SplatComponent to use Record<string, unknown> instead of SogsMeta.
- Removed SogsMeta and related type definitions from splat-viewer.tsx to simplify the codebase.
- Updated the useAsset hook to replace the `props` parameter with `file`, aligning with PlayCanvas Asset properties.
- Adjusted related hooks (useSplat, useTexture, useEnvAtlas, useModel) to reflect the new parameter naming.
- Enhanced documentation to clarify the purpose of `file` and `data` parameters in asset loading.
- Renamed `isSogsMeta` to `isObject` for clarity in the SplatComponent.
- Updated the logic for determining the source and options passed to the useSplat hook to enhance readability and maintainability.
…arity and functionality

- Updated the useAsset hook to replace the `props` parameter with a more descriptive structure, enhancing the clarity of asset loading.
- Adjusted related hooks (useSplat, useTexture, useEnvAtlas, useModel) to align with the new parameter naming and structure.
- Enhanced documentation to clarify the purpose of the new props structure in asset loading.
- Removed deprecated parameters and streamlined the fetchAsset utility to support the updated props format.
…ntation

- Updated the useAsset hook to rename the `data` parameter to `props`, improving clarity in asset loading.
- Adjusted the queryKey and fetchAsset calls to utilize the new `props` parameter.
- Enhanced documentation to reflect the updated parameter naming and its purpose in asset loading.
@marklundin marklundin changed the title Add support for SOGS Add SplatViewer SOGS Compression Jun 5, 2025
@marklundin marklundin merged commit 9466f35 into main Jun 5, 2025
5 checks passed
@marklundin marklundin deleted the feat-sogs-blocks branch June 5, 2025 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocks enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant