fix(webgl): share single Pixi context between KiraAvatar and Live2DCat
Eliminates WebGL bindBuffer/bindTexture spam from dual Application contexts. Cat model now loads onto KiraAvatar's shared stage via onAppReady callback.
This commit is contained in:
@@ -7,6 +7,7 @@ interface Props {
|
||||
outfit: string;
|
||||
accessory: string | null;
|
||||
onTalkToggle: () => void;
|
||||
onAppReady?: (app: any) => void;
|
||||
}
|
||||
|
||||
type ExpressionName = 'Normal' | 'Smile' | 'Sad' | 'Angry' | 'Surprised' | 'Blushing';
|
||||
@@ -82,6 +83,8 @@ export default function KiraAvatar(props: Props) {
|
||||
app.stage.addChild(model as any);
|
||||
(model as any).isInteractive = () => false;
|
||||
|
||||
if (props.onAppReady) props.onAppReady(app);
|
||||
|
||||
try {
|
||||
textureRef.current = {
|
||||
index: 2,
|
||||
|
||||
Reference in New Issue
Block a user