current state

This commit is contained in:
dimitar committed 2026-05-28 15:20:02 +02:00
1 parent 42b58b02bf
commit 152ef17610
115 files changed
+2922 -704

No files matched your search

+24
View File
@@ -206,6 +206,30 @@ extract_color_palette :: proc(description: string) -> Color_Palette {
}
}
update_character_from_description :: proc(c: Character) -> Character {
updated := c
template := parse_description_to_template(c.description)
color_palette := extract_color_palette(c.description)
updated.prompt_template = template
updated.color_palette = color_palette
if updated.seed == 0 {
updated.seed = derive_seed_from_string(c.name)
}
return updated
}
update_all_characters_from_descriptions :: proc(characters: []Character) -> []Character {
if len(characters) == 0 {
return characters
}
updated: [dynamic]Character
for c in characters {
append(&updated, update_character_from_description(c))
}
return updated[:]
}
template_to_string :: proc(t: Character_Prompt_Template) -> string {
parts: [dynamic]string
+10 -3
View File
@@ -8,7 +8,7 @@ DEFAULT_PROMPT_BODY :: "average"
DEFAULT_PROMPT_OUTFIT :: "casual clothing"
DEFAULT_PROMPT_ACCESSORIES :: "no accessories"
build_character_prompt :: proc(c: Character, action, setting, lighting, art_style: string) -> string {
build_character_prompt :: proc(c: Character, action, setting, lighting: string) -> string {
t := c.prompt_template
age := t.age
@@ -23,8 +23,7 @@ build_character_prompt :: proc(c: Character, action, setting, lighting, art_styl
if len(accessories) == 0 { accessories = DEFAULT_PROMPT_ACCESSORIES }
return fmt.aprintf(
"%s style. %s-year-old %s, %s %s hair, %s eyes, %s skin, %s build, wearing %s, %s, %s, %s, %s, %s",
art_style,
"%syear-old %s, %s %s hair, %s eyes, %s skin, %s build, wearing %s, %s, %s, %s, %s, %s",
age,
gender,
t.hair_color,
@@ -41,6 +40,14 @@ build_character_prompt :: proc(c: Character, action, setting, lighting, art_styl
)
}
build_character_prompt_with_style :: proc(c: Character, action, setting, lighting, art_style: string) -> string {
base := build_character_prompt(c, action, setting, lighting)
if len(art_style) == 0 {
return base
}
return fmt.aprintf("%s style. %s", art_style, base)
}
derive_seed_from_string :: proc(s: string) -> i64 {
hash: i32 = 0
for r in s {
+57
View File
@@ -24,6 +24,63 @@ get_style_keywords :: proc(key: Art_Style_Key) -> string {
return keywords[int(key)]
}
Genre_Keyword_Entry :: struct {
key: string,
keywords: string,
}
GENRE_KEYWORDS :: [14]Genre_Keyword_Entry{
{"action", "action-packed, dynamic compositions, explosive motion, intense combat, heroic moments, dramatic clashes"},
{"adventure", "epic adventure, sprawling landscapes, exploration, treasure maps, ancient ruins, journey narrative"},
{"romance", "romantic atmosphere, tender moments, soft lighting, emotional glances, intimate compositions, warm palette"},
{"comedy", "comedic, exaggerated expressions, slapstick poses, funny situations, dynamic sight gags, lively energy"},
{"horror", "horror atmosphere, dark shadows, eerie lighting, unsettling composition, creepy textures, menacing ambiance"},
{"sci-fi", "science fiction, futuristic technology, space environments, advanced gadgets, alien architecture, high-tech aesthetics"},
{"fantasy", "fantasy world, magical effects, mythical creatures, enchanted environments, arcane symbols, ethereal lighting"},
{"mystery", "mystery and intrigue, moody shadows, noir lighting, suspenseful composition, hidden details, fog and mist"},
{"slice of life", "slice of life, everyday warmth, cozy interiors, natural lighting, relatable moments, gentle pacing"},
{"drama", "dramatic tension, emotional intensity, cinematic lighting, powerful expressions, charged atmosphere"},
{"superhero", "superhero, heroic poses, dynamic action, bold colors, iconic costumes, epic scale, power effects"},
{"mecha", "mecha, giant robots, mechanical details, cockpit interiors, metallic surfaces, transformable machines"},
{"thriller", "thriller, tense atmosphere, paranoid compositions, sharp shadows, edge-of-seat framing, cliffhanger moments"},
{"historical", "historical, period-accurate details, classical architecture, period costumes, aged textures, antiqued palette"},
}
get_genre_keywords :: proc(genre: string) -> string {
if len(genre) == 0 { return "" }
lower := strings.to_lower(strings.trim_space(genre))
for entry in GENRE_KEYWORDS {
if strings.contains(lower, entry.key) {
return entry.keywords
}
}
return ""
}
Audience_Keyword_Entry :: struct {
key: string,
keywords: string,
}
AUDIENCE_KEYWORDS :: [5]Audience_Keyword_Entry{
{"children", "child-friendly, bright colors, simple shapes, round features, safe content, age-appropriate, whimsical"},
{"teens", "teen-oriented, expressive characters, relatable themes, modern style, vibrant energy, coming-of-age"},
{"young adult", "young adult, sophisticated storytelling, complex characters, stylish art, mature themes, contemporary feel"},
{"adults", "mature audience, sophisticated composition, nuanced storytelling, detailed artwork, complex themes"},
{"all ages", "all-ages appeal, clean art, universal themes, accessible design, family-friendly, broad appeal"},
}
get_audience_keywords :: proc(audience: string) -> string {
if len(audience) == 0 { return "" }
lower := strings.to_lower(strings.trim_space(audience))
for entry in AUDIENCE_KEYWORDS {
if strings.contains(lower, entry.key) {
return entry.keywords
}
}
return ""
}
parse_art_style_key :: proc(raw: string) -> Art_Style_Key {
lower := strings.to_lower(raw)
if strings.contains(lower, "manga") { return .Manga }
+7 -5
View File
@@ -1,20 +1,22 @@
package core
import "core:strings"
new_initial_state :: proc() -> Comic_State {
iso := ""
return Comic_State{
project = Project_Metadata{
project_id = "proj_todo",
project_name = "Untitled Comic",
project_id = strings.clone("proj_todo"),
project_name = strings.clone("Untitled Comic"),
created_at_iso = iso,
last_modified_iso = iso,
},
user_mode = .Casual,
story_idea = "",
story_genre = "action",
target_audience = "general",
art_style = "manga",
story_genre = strings.clone("action"),
target_audience = strings.clone("general"),
art_style = strings.clone("manga"),
export_format = .PDF,
page_size = .A4,
color_profile = .RGB,