This commit is contained in:
2025-03-28 11:23:05 +08:00
parent d4e86e60ff
commit 0d8786f471

View File

@ -5,7 +5,8 @@ import { FontLoader } from 'three/addons/loaders/FontLoader.js'
import { TextGeometry } from 'three/addons/geometries/TextGeometry.js' import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'
import HelvetikerRegular from "three/examples/fonts/helvetiker_regular.typeface.json" import HelvetikerRegular from "three/examples/fonts/helvetiker_regular.typeface.json"
import { useEffect, useRef, useState, JSX } from 'react' import { useEffect, useRef, useState, JSX } from 'react'
import POSE_3D_ from "./assets/result_ae_01_ae_08.json" // import POSE_3D_ from "./assets/result_ae_01_ae_08.json"
import POSE_3D_ from "./assets/temp_result.json"
// F, 133, 3 // F, 133, 3
const POSE_3D: Array<Array<[number, number, number]>> = POSE_3D_ as [number, number, number][][] const POSE_3D: Array<Array<[number, number, number]>> = POSE_3D_ as [number, number, number][][]
@ -35,9 +36,9 @@ const Z_UP_TO_Y_UP = new THREE.Matrix4().set(
) )
const Z_UP_TO_Y_UP_PRIME = new THREE.Matrix4().set( const Z_UP_TO_Y_UP_PRIME = new THREE.Matrix4().set(
-1, 0, 0, 0, 1, 0, 0, 0,
0, 0, 1, 0, 0, 0, 1, 0,
0, -1, 0, 0, 0, 1, 0, 0,
0, 0, 0, 1 0, 0, 0, 1
) )
@ -59,7 +60,7 @@ const BODY_BONES = [
[1, 2], [0, 1], [0, 2], [1, 3], [2, 4], // head [1, 2], [0, 1], [0, 2], [1, 3], [2, 4], // head
[15, 17], [15, 18], [15, 19], // left foot [15, 17], [15, 18], [15, 19], // left foot
[16, 20], [16, 21], [16, 22], // right foot [16, 20], [16, 21], [16, 22], // right foot
] ] as const
// Body bone colors // Body bone colors
const BODY_BONE_COLORS = [ const BODY_BONE_COLORS = [
@ -69,7 +70,7 @@ const BODY_BONE_COLORS = [
COLOR_HEAD, COLOR_HEAD, COLOR_HEAD, COLOR_HEAD, COLOR_HEAD, COLOR_HEAD, COLOR_HEAD, COLOR_HEAD, COLOR_HEAD, COLOR_HEAD,
COLOR_FOOT, COLOR_FOOT, COLOR_FOOT, COLOR_FOOT, COLOR_FOOT, COLOR_FOOT,
COLOR_FOOT, COLOR_FOOT, COLOR_FOOT, COLOR_FOOT, COLOR_FOOT, COLOR_FOOT,
] ] as const
// Hand bone connections (in pairs of [start, end] indices) // Hand bone connections (in pairs of [start, end] indices)
const HAND_BONES = [ const HAND_BONES = [
@ -85,14 +86,14 @@ const HAND_BONES = [
[112, 121], [121, 122], [122, 123], [123, 124], // left middle [112, 121], [121, 122], [122, 123], [123, 124], // left middle
[112, 125], [125, 126], [126, 127], [127, 128], // left ring [112, 125], [125, 126], [126, 127], [127, 128], // left ring
[112, 129], [129, 130], [130, 131], [131, 132] // left pinky [112, 129], [129, 130], [130, 131], [131, 132] // left pinky
] ] as const
const DEFAULT_TRANSFORMATION_MATRIX = [ const DEFAULT_TRANSFORMATION_MATRIX = [
1, 0, 0, 0, 1, 0, 0, 0,
0, 1, 0, 0, 0, 1, 0, 0,
0, 0, 1, 0, 0, 0, 1, 0,
0, 0, 0, 1, 0, 0, 0, 1,
] ] as const
const DEFAULT_NEAR = 0.05 const DEFAULT_NEAR = 0.05
const DEFAULT_FAR = 1 const DEFAULT_FAR = 1
const CAMERA_EXTRINSIC_MATRIX_MAP: Record<string, number[]> = { const CAMERA_EXTRINSIC_MATRIX_MAP: Record<string, number[]> = {
@ -101,37 +102,37 @@ const CAMERA_EXTRINSIC_MATRIX_MAP: Record<string, number[]> = {
0.02634936, -0.99728089, 0.03661007, 0.97025299, 0.23080732, 0.02634936, -0.99728089, 0.03661007, 0.97025299, 0.23080732,
0.07305554, 3.34933242, 0., 0., 0., 0.07305554, 3.34933242, 0., 0., 0.,
1. 1.
], ] as const,
"AE_1A": [ "AE_1A": [
0.93194049, -0.35571886, -0.07036343, -0.92123075, 0.01084819, 0.93194049, -0.35571886, -0.07036343, -0.92123075, 0.01084819,
0.22131041, -0.97514308, 0.24922173, 0.36244895, 0.908012, 0.22131041, -0.97514308, 0.24922173, 0.36244895, 0.908012,
0.21010704, 4.87284891, 0., 0., 0., 0.21010704, 4.87284891, 0., 0., 0.,
1. 1.
], ] as const,
"AE_08": [ "AE_08": [
0.66806102, -0.74355508, -0.02864123, -1.10173496, 0.05931037, 0.66806102, -0.74355508, -0.02864123, -1.10173496, 0.05931037,
0.09157787, -0.99403007, 0.26760438, 0.74173901, 0.66237402, 0.09157787, -0.99403007, 0.26760438, 0.74173901, 0.66237402,
0.10528013, 6.92372493, 0., 0., 0., 0.10528013, 6.92372493, 0., 0., 0.,
1. 1.
] ] as const
} as const }
const CAMERA_INTRINSIC_MATRIX_MAP: Record<string, number[]> = { const CAMERA_INTRINSIC_MATRIX_MAP: Record<string, number[]> = {
"AE_01": [ "AE_01": [
1806.82137617, 0., 1230.53175624, 0., 1806.82137617, 0., 1230.53175624, 0.,
1809.75580378, 766.36204406, 0., 0., 1809.75580378, 766.36204406, 0., 0.,
1. 1.
], ] as const,
"AE_1A": [ "AE_1A": [
3467.39715751, 0., 1000.62548655, 0., 3467.39715751, 0., 1000.62548655, 0.,
3473.7168112, 831.64048503, 0., 0., 3473.7168112, 831.64048503, 0., 0.,
1. 1.
], ] as const,
"AE_08": [ "AE_08": [
2785.43931794, 0., 1254.98272372, 0., 2785.43931794, 0., 1254.98272372, 0.,
2788.10437965, 738.82985324, 0., 0., 2788.10437965, 738.82985324, 0., 0.,
1. 1.
] ] as const
} as const }
const IMAGE_WIDTH = 2560 const IMAGE_WIDTH = 2560
const IMAGE_HEIGHT = 1440 const IMAGE_HEIGHT = 1440