Skip to content

chara_3d

Anthony Samms edited this page Jun 2, 2026 · 1 revision

Chara3D renders and animates the 3D Don-chan model. It loads a costume .glb model, applies a shared animation set, and handles per-frame bone updates and face expression changes.

AnimIndex

An enum identifying each animation by logical name. Every animation has a mirrored counterpart (e.g. DON_NORMAL_MIRROR) used for P2.

Value Description
DON_NORMAL Idle loop, beat-synced
DON_SABI Sabi (chorus) idle loop
DON_GENERAL_LOOP Generic looping animation
DON_GENERAL_JUMP Jump, plays once then returns to previous loop
DON_MISS Miss reaction, plays once
DON_MISS6 >= 6 miss reaction, plays once
DON_MISS_NORMAL Normal-mode miss, plays once
DON_COMBO Combo milestone, plays once
DON_FULL_COMBO Full combo, plays once
DON_FULL_GAGE Full gauge, plays once
DON_BIND Bind animation, plays once
DON_FUKKATU_START Revival start, plays once
DON_FUKKATU_LOOP Revival loop
DON_BALLOON_LOOP Balloon hit loop (double BPM)
DON_BALLOON_SUCCESS Balloon cleared, plays once
DON_BALLOON_FAILURE Balloon failed, plays once
DON_BALLOON_NOBEAT Balloon with no beat, loop
DON_ENTRY_IN Entry screen entrance, plays once
DON_ENTRY_LOOP Entry screen idle loop
DON_SELECT_LOOP Song select idle loop
DON_SELECT_PANELUP Panel sliding up, plays once
DON_SELECT_PANELDOWN Panel sliding down, plays once
DON_NORM_UP Norm up, plays once
DON_NORM_DOWN Norm down, plays once
DON_NORM_LOOP Norm loop

Chara3D

Chara3D(std::string& model_name, bool mirror = false);

Loads the costume model from Skins/<skin>/Models/cos/<model_name>.glb and the shared animation set from Models/animations.glb. Re-indexes animation bones to match the costume skeleton, applies default Don colors, loads face textures from Models/face/, and loads face animations from Graphics/global/animation.json. Sets the initial animation to DON_NORMAL.

Members

Member Type Description
mirror bool Whether the model is horizontally mirrored (used for P2)

Appearance

void set_body_texture(fs::path& texture_path);

Replaces the body texture on the RGB_don_color material.

void set_face_rim_texture(fs::path& texture_path);

Replaces the face rim texture on the don_FACEHIP material.

void set_don_colors(ray::Color body, ray::Color face, ray::Color rim);

Recolors all materials tagged taikoEffectChangeColors in the .glb by mapping the red, green, and blue pixel channels to the provided body, face, and rim colors respectively.

Animation Control

void set_bpm(float bpm);

Sets the BPM used to pace animation frames. The idle and sabi loops run at one beat per three frames; the balloon loop runs at double speed.

void set_anim(AnimIndex idx);

Switches to the given animation from the next update. Non-looping animations automatically return to the previous looping animation when they finish. Also updates the face expression animation.

int get_anim_count() const;
std::string get_anim_name(int idx);

Returns the number of loaded animations and the name of animation at index idx.

Update and Draw

void update(double current_ms);

Advances the skeleton animation by one frame when enough time has elapsed based on BPM. Applies the face expression texture when the face animation advances.

void draw(float x, float y);

Draws the model at the given screen position. Renders an outline pass first using a custom shader (back-face culled, depth disabled), then renders the main model with depth testing enabled.

Clone this wiki locally