Skip to content

Commit

Permalink
Added code for both
Browse files Browse the repository at this point in the history
  • Loading branch information
mayankdigii committed Nov 22, 2024
1 parent 5513820 commit bd044fd
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/lib/babylon/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,47 @@ export async function render(canvas: HTMLCanvasElement, config: PreviewConfig):
scene.render()
break
case 'both':
outlineShaderMaterial.backFaceCulling = false
outlineShaderMaterial.setColor4('_BaseColor', new Color4(1, 0.75, 0.8, 1))
for (const mesh of scene.meshes) {
if (meshIDsToOutline?.includes(mesh?.id)) {
mesh.material = outlineShaderMaterial // Assign the outline shader material
}
}
engine.clear(scene.clearColor, true, true)
scene.render()
for (const mesh of scene.meshes) {
switch (mesh?.id) {
case 'M_Hair_Standard_01':
mesh.material = hairShaderMaterial
break
case 'M_uBody_Hoodie_01':
mesh.material = upperBodyShaderMaterial
break
case 'M_uBody_Hoodie_02':
mesh.material = upperBodyShaderMaterial
break
case 'M_lBody_LongPants_01_primitive0':
mesh.material = lowerBodyShaderMaterial
break
case 'M_lBody_LongPants_01_primitive1':
mesh.material = lowerBodyShaderMaterial
break
case 'M_Feet_Sneakers_01_primitive0':
mesh.material = feetShaderMaterial
break
case 'M_Feet_Sneakers_02':
mesh.material = feetShaderMaterial
break

default:
// Optional: Handle cases where no match is found
break
}
hl.innerGlow = false
mesh.computeBonesUsingShaders = false
}
scene.render()
break
default:
console.warn(`Unknown render mode: ${renderMode}`)
Expand Down

0 comments on commit bd044fd

Please sign in to comment.