Skip to content

Commit

Permalink
revert colors
Browse files Browse the repository at this point in the history
  • Loading branch information
azaleacolburn committed Aug 22, 2024
1 parent 691c7d0 commit e328c03
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions fission/src/mirabuf/MirabufInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ const fillerMaterials = [
}),
]

type Color = { A: number; B: number; G: number; R: number }

Check warning on line 56 in fission/src/mirabuf/MirabufInstance.ts

View workflow job for this annotation

GitHub Actions / ESLint Format Validation

'Color' is defined but never used. Allowed unused vars must match /^_/u

const transformVerts = (mesh: mirabuf.IMesh) => {
const newVerts = new Float32Array(mesh.verts!.length)
for (let i = 0; i < mesh.verts!.length; i += 3) {
Expand Down Expand Up @@ -128,11 +130,15 @@ class MirabufInstance {
* Parses all mirabuf appearances into ThreeJS and Jolt materials.
*/
private LoadMaterials(materialStyle: MaterialStyle) {
(
Object.entries(this._mirabufParser.assembly.data!.materials!.appearances!) as [string, mirabuf.Color][]
).forEach(([appearanceId, { A, B, G, R }]) => {
const hex = (A << 24) | (R << 16) | (G << 8) | B
const opacity = A / 255.0
;(

Check failure on line 133 in fission/src/mirabuf/MirabufInstance.ts

View workflow job for this annotation

GitHub Actions / ESLint Format Validation

Unnecessary semicolon
Object.entries(this._mirabufParser.assembly.data!.materials!.appearances!) as [
string,
mirabuf.material.Appearance,
][]
).forEach(([appearanceId, appearance]) => {
const { A, B, G, R } = appearance.albedo ?? {}
const [hex, opacity] =
A && B && G && R ? [(A << 24) | (R << 16) | (G << 8) | B, A / 255.0] : [0xe32b50, 1.0]

const material =
materialStyle === MaterialStyle.Regular
Expand Down

0 comments on commit e328c03

Please sign in to comment.