three-ts-types icon indicating copy to clipboard operation
three-ts-types copied to clipboard

Three json

Open Hoodgail opened this issue 2 years ago • 2 comments

  • [x] Skeleton
  • [x] Euler
  • [x] Quaternion
  • [x] AnimationClip
  • [x] KeyframeTrack
  • [x] Skeleton
  • [x] Matrix3
  • [x] Matrix4
  • [x] Object3D
  • [x] Path
  • [x] Texture
  • [x] Vector2
  • [x] Source
  • [x] Euler
  • [x] Curve
  • [x] CurvePath
  • [x] BufferGeometry
  • [x] BufferAttribute

Extended Objects

  • [ ] Scene
  • [x] Mesh
  • [x] InstancedMesh
  • [ ] PerspectiveCamera
  • [ ] OrthographicCamera
  • [x] Group
  • [x] Bone
  • [ ] Line
  • [ ] Sprite
  • [x] SkinnedMesh
  • [ ] Points
  • [ ] LOD
  • [ ] LineSegments
  • [ ] LineLoop
  • [ ] Fog
  • [ ] FogExp2

If you're wondering why i would give Bone, and Group their own types, its because of their .type

Hoodgail avatar Apr 26 '23 14:04 Hoodgail

@Methuselah96 What do you think of the progress so far? let me know if how i'm doing it is good before i continue

Hoodgail avatar Apr 26 '23 18:04 Hoodgail

@kourser Reminder to finish this.

Hoodgail avatar May 20 '23 21:05 Hoodgail

Note to self https://github.com/three-types/three-ts-types/blob/8109927fa28df9359537ea3cdc1b4c777b905a12/types/three/src/core/Object3D.d.ts#L646

expected output format:

{
    geometries: geojson[]
    materials: materialjson[]
    textures: texturejson[]
    images: imagejson[]
    object: Object3DJSON
}

Hoodgail avatar Jul 08 '24 11:07 Hoodgail

Thank you

Hoodgail avatar Jul 17 '24 19:07 Hoodgail

@Hoodgail I traced this PR as the source of the QuaternionTuple change here

https://github.com/three-types/three-ts-types/blame/a6fadb5785285a73ccf9f9dbc8b81186c7ebfa42/types/three/src/math/Quaternion.d.ts#L14

Since fromArray is typed as

fromArray(array: QuaternionTuple, offset?: number): this;

it produces an error when provided an array that doesn't strictly have 4 elements, which is expected when passing an offset. This makes it impractical to use in common scenarios such as when the array is a Float32Array (e.g. packed buffer of multiple quaternions) or otherwise contains >4 elements.

CleanShot 2024-09-17 at 18 03 09@2x

https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAKjgQwM5wCoAkBKBRPOAMyghDgHIYALKAUzooCgmBjCAO1XgEcBXZPAC8cDnQDumXAQB0ARQEw6UDsE4AKAJQt2XeDACeYOgBMAglCjIDcEWMkAxADYRBAZgBMFqwfUAObV1uOAgiIlQ6YTgAFhZ+QRkSMm9rdUNjc0trABoQsIiYTSA

Is there a reason array needs to be typed this way?

mattrossman avatar Sep 17 '24 22:09 mattrossman

@mattrossman It looks like this was an oversight on my part. I had completely forgot about the offset argument

It should follow the same way its written in Vector3 at https://github.com/three-types/three-ts-types/blob/a6fadb5785285a73ccf9f9dbc8b81186c7ebfa42/types/three/src/math/Vector3.d.ts#L269 {D400AF8F-C00C-4E49-B28E-30EA41E23447}

Will you make a pull request? or should i? My apologies !

Hoodgail avatar Sep 17 '24 23:09 Hoodgail

@Hoodgail I've submitted a PR https://github.com/three-types/three-ts-types/pull/1230, thank you for the suggested fix!

mattrossman avatar Sep 18 '24 16:09 mattrossman