reze-engine 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/model.ts CHANGED
@@ -23,6 +23,9 @@ export interface Material {
23
23
  edgeColor: [number, number, number, number]
24
24
  edgeSize: number
25
25
  vertexCount: number
26
+ isEye?: boolean // New: marks eye materials
27
+ isFace?: boolean // New: marks face/skin materials
28
+ isHair?: boolean // New: marks hair materials
26
29
  }
27
30
 
28
31
  export interface Bone {
package/src/pmx-loader.ts CHANGED
@@ -262,7 +262,7 @@ export class PmxLoader {
262
262
  // PMX material flag bits:
263
263
  // Bit 0 (0x01): Double-sided rendering
264
264
  // Bit 4 (0x10): Edge drawing (outline)
265
- this.materials.push({
265
+ const mat: Material = {
266
266
  name,
267
267
  diffuse,
268
268
  specular,
@@ -277,7 +277,30 @@ export class PmxLoader {
277
277
  edgeColor,
278
278
  edgeSize,
279
279
  vertexCount,
280
- })
280
+ }
281
+
282
+ // Classify materials based on name
283
+ const materialName = name.toLowerCase()
284
+
285
+ // Classify eye materials
286
+ mat.isEye =
287
+ materialName.includes("目") || // Japanese "eye"
288
+ materialName.includes("瞳") || // Japanese "pupil"
289
+ materialName.includes("eye") ||
290
+ materialName.includes("pupil") ||
291
+ materialName.includes("iris") ||
292
+ materialName.includes("目白") ||
293
+ materialName.includes("眼") ||
294
+ materialName.includes("睛") ||
295
+ materialName.includes("眉")
296
+
297
+ // Classify face materials
298
+ mat.isFace = materialName.includes("face") || materialName.includes("脸")
299
+
300
+ // Classify hair materials
301
+ mat.isHair = materialName.includes("hair_f")
302
+
303
+ this.materials.push(mat)
281
304
  }
282
305
  } catch (error) {
283
306
  console.error("Error parsing materials:", error)