Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 18 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"@geckos.io/server": "^3.0.0",
"@tweakpane/plugin-essentials": "^0.2.1",
"express": "5.1.0",
"three": "^0.176.0",
"three": "^0.184.0",
"three-perf": "^1.0.11",
"tweakpane": "^4.0.5",
"vite": "^6.3.5",
Expand All @@ -65,12 +65,12 @@
"@testing-library/jest-dom": "^6.9.1",
"@tweakpane/plugin-essentials": "^0.2.1",
"@types/express": "^5.0.3",
"@types/three": "^0.176.0",
"@types/three": "^0.184.0",
"@vitejs/plugin-react": "^5.1.2",
"@vitest/coverage-v8": "^3.2.4",
"@vitest/ui": "^3.2.4",
"jsdom": "^28.1.0",
"three": "^0.176.0",
"three": "^0.184.0",
"three-perf": "^1.0.11",
"tweakpane": "^4.0.5",
"typescript": "5.9.2",
Expand Down
6 changes: 3 additions & 3 deletions packages/editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
},
"peerDependencies": {
"@mavonengine/core": "*",
"three": "^0.176.0"
"three": "^0.184.0"
},
"dependencies": {
"@tweakpane/core": "^2.0.5",
Expand All @@ -57,13 +57,13 @@
"@testing-library/react": "^16.3.2",
"@types/react": "^19.2.10",
"@types/react-dom": "^19.2.3",
"@types/three": "^0.176.0",
"@types/three": "^0.184.0",
"@vitejs/plugin-react": "^5.1.2",
"@vitest/coverage-v8": "^3.2.4",
"@vitest/ui": "^3.2.4",
"glob": "^10.5.0",
"jsdom": "^28.1.0",
"three": "^0.176.0",
"three": "^0.184.0",
"typescript": "5.9.2",
"vite": "^6.3.5",
"vite-plugin-glsl": "^1.4.1",
Expand Down
5 changes: 3 additions & 2 deletions packages/editor/src/Editor/UI/Assets/Assets.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { DragEvent } from 'react'
import type { CubeTexture, Object3D, Scene } from 'three'
import type { Font, GLTF, SVGResult } from 'three/examples/jsm/Addons.js'
import type { RawImage } from './TextureViewer'
import EditorHelper from '@mavonengine/core/Editor/EditorHelper'
import Game from '@mavonengine/core/Game'
import { getPreviewMap, spawnParticle } from '@mavonengine/core/Particles/System/ParticlePreviewRegistry'
Expand Down Expand Up @@ -356,7 +357,7 @@ export default () => {
>
{item instanceof AudioBuffer && <AudioPlayer buffer={item} />}
{'scene' in item && <ModelViewer model={item.scene} animations={(item as GLTF).animations} />}
{item instanceof Texture && <TextureViewer texture={item} />}
{item instanceof Texture && <TextureViewer texture={item as Texture<RawImage>} />}
{'particleName' in item && <ParticleViewer particleName={item.particleName} />}
</Window>
)
Expand Down Expand Up @@ -532,7 +533,7 @@ export default () => {
onDoubleClick={() => openAsset(key, item)}
onDragStart={e => onItemDragStart(e, key)}
draggable
src={getTextureUrl(item)}
src={getTextureUrl(item as Texture<RawImage>)}
/>
)
: (
Expand Down
20 changes: 12 additions & 8 deletions packages/editor/src/Editor/UI/Assets/TextureViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { useEffect, useRef, useState } from 'react'
import AssetStats from './AssetStats'
import styles from './TextureViewer.module.css'

type RawImage = HTMLImageElement | HTMLCanvasElement | ImageBitmap
export type RawImage = HTMLImageElement | HTMLCanvasElement | ImageBitmap

function isCubeTexture<HTMLImageElement>(t: Texture<RawImage> | CubeTexture<HTMLImageElement>): t is CubeTexture<HTMLImageElement> {
return Array.isArray(t.image)
}

function imageToUrl(img: RawImage): string {
if (img instanceof HTMLImageElement)
Expand All @@ -20,8 +24,8 @@ function imageToUrl(img: RawImage): string {
return ''
}

export function getTextureUrl(texture: Texture | CubeTexture): string {
const img = Array.isArray(texture.image) ? texture.image[0] : texture.image
export function getTextureUrl(texture: Texture<RawImage> | CubeTexture<HTMLImageElement>): string {
const img = isCubeTexture<HTMLImageElement>(texture) ? texture.image[0] : texture.image
return img ? imageToUrl(img) : ''
}

Expand All @@ -38,7 +42,7 @@ function formatColorSpace(cs: string): string {
return cs
}

// Three.js CubeTexture face order: +X, -X, +Y, -Y, +Z, -Z
// Three.js CubeTexture<HTMLImageElement> face order: +X, -X, +Y, -Y, +Z, -Z
// Cross layout (4 cols × 3 rows):
// . +Y . .
// -X +Z +X -Z
Expand All @@ -58,9 +62,9 @@ const CUBE_FACES: Array<{ label: string, faceIndex: number } | null> = [
null, // [2,3]
]

export default ({ texture }: { texture: Texture | CubeTexture }) => {
const isCube = Array.isArray(texture.image)
const img = isCube ? texture.image[0] : texture.image
export default ({ texture }: { texture: Texture<RawImage> | CubeTexture<HTMLImageElement> }) => {
const isCube = isCubeTexture<HTMLImageElement>(texture)
const img = isCubeTexture<HTMLImageElement>(texture) ? texture.image[0] : texture.image
const width = img?.width ?? 0
const height = img?.height ?? 0

Expand Down Expand Up @@ -136,7 +140,7 @@ export default ({ texture }: { texture: Texture | CubeTexture }) => {
className={styles.zoomInner}
style={{ transform: `translate(${transform.x}px, ${transform.y}px) scale(${transform.scale})` }}
>
{isCube
{isCubeTexture<HTMLImageElement>(texture)
? (
<div className={styles.cubeCross}>
{CUBE_FACES.map((face, i) =>
Expand Down
2 changes: 1 addition & 1 deletion packages/multiplayer-template/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@vitejs/plugin-vue": "^5.2.4",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"three": "^0.176.0",
"three": "^0.184.0",
"typescript": "5.9.2",
"vite": "^6.3.5",
"vite-plugin-glsl": "^1.4.1"
Expand Down
48 changes: 27 additions & 21 deletions packages/multiplayer-template/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/multiplayer-template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"devDependencies": {
"@antfu/eslint-config": "^8.0.0",
"@mavonengine/editor": "0.0.7",
"@types/three": "^0.176.0",
"@types/three": "^0.184.0",
"concurrently": "^9.1.2",
"eslint": "^10.1.0",
"tsup": "^8.5.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/multiplayer-template/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@dimforge/rapier3d-compat": "0.18.2",
"@geckos.io/server": "3.1.0",
"express": "5.1.0",
"three": "^0.176.0",
"three": "^0.184.0",
"winston": "^3.17.0"
},
"devDependencies": {
Expand Down
Loading