persona-community-1/pkg/persona/body.go
jordan 4004f88f4a
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/manual/woodpecker Pipeline was successful
Initialize project from skeleton template
2026-02-23 10:20:59 +00:00

149 lines
4.5 KiB
Go

package persona
// BodyDNA contains all body specifications for a character.
// These define the physical build and proportions for consistent rendering.
type BodyDNA struct {
// Height is the descriptive height category.
Height HeightCategory `json:"height" yaml:"height"`
// HeightCM is the exact height in centimeters.
HeightCM int `json:"height_cm" yaml:"height_cm"`
// Build is the overall body type category.
Build BodyBuildCategory `json:"build" yaml:"build"`
// BodyFatPercent is the approximate body fat percentage (for rendering guidance).
BodyFatPercent int `json:"body_fat_percent" yaml:"body_fat_percent"`
// MuscleDefinition describes the level of visible muscle definition.
MuscleDefinition MuscleDefinitionCategory `json:"muscle_definition" yaml:"muscle_definition"`
// ShoulderWidth describes shoulder width relative to body.
ShoulderWidth ShoulderWidthCategory `json:"shoulder_width" yaml:"shoulder_width"`
// HipWidth describes hip width relative to body.
HipWidth HipWidthCategory `json:"hip_width" yaml:"hip_width"`
// WHRatio is the waist-to-hip ratio (e.g., 0.7 for hourglass figure).
WHRatio float64 `json:"wh_ratio" yaml:"wh_ratio"`
// LegLength describes leg length proportion.
LegLength LegLengthCategory `json:"leg_length" yaml:"leg_length"`
// TorsoLength describes torso length proportion.
TorsoLength TorsoLengthCategory `json:"torso_length" yaml:"torso_length"`
// BustSize describes bust size for female/feminine characters.
BustSize BustSizeCategory `json:"bust_size,omitempty" yaml:"bust_size,omitempty"`
// PostureType describes characteristic posture.
PostureType PostureCategory `json:"posture_type" yaml:"posture_type"`
}
// Height categories
type HeightCategory string
const (
HeightPetite HeightCategory = "petite" // < 5'2" / 157cm
HeightShort HeightCategory = "short" // 5'2"-5'4" / 157-163cm
HeightAverage HeightCategory = "average" // 5'4"-5'6" / 163-168cm
HeightTall HeightCategory = "tall" // 5'6"-5'9" / 168-175cm
HeightVeryTall HeightCategory = "very_tall" // > 5'9" / 175cm+
)
// HeightCategoryFromCM returns the height category for a given height in cm.
func HeightCategoryFromCM(cm int) HeightCategory {
switch {
case cm < 157:
return HeightPetite
case cm < 163:
return HeightShort
case cm < 168:
return HeightAverage
case cm < 175:
return HeightTall
default:
return HeightVeryTall
}
}
// Body build categories
type BodyBuildCategory string
const (
BodyBuildSlender BodyBuildCategory = "slender"
BodyBuildAthletic BodyBuildCategory = "athletic"
BodyBuildCurvy BodyBuildCategory = "curvy"
BodyBuildMuscular BodyBuildCategory = "muscular"
BodyBuildAverage BodyBuildCategory = "average"
BodyBuildPlusCurvy BodyBuildCategory = "plus_curvy"
BodyBuildPetite BodyBuildCategory = "petite"
)
// Muscle definition categories
type MuscleDefinitionCategory string
const (
MuscleDefinitionNone MuscleDefinitionCategory = "none"
MuscleDefinitionSubtle MuscleDefinitionCategory = "subtle"
MuscleDefinitionModerate MuscleDefinitionCategory = "moderate"
MuscleDefinitionDefined MuscleDefinitionCategory = "defined"
MuscleDefinitionRipped MuscleDefinitionCategory = "ripped"
)
// Shoulder width categories
type ShoulderWidthCategory string
const (
ShoulderWidthNarrow ShoulderWidthCategory = "narrow"
ShoulderWidthAverage ShoulderWidthCategory = "average"
ShoulderWidthBroad ShoulderWidthCategory = "broad"
)
// Hip width categories
type HipWidthCategory string
const (
HipWidthNarrow HipWidthCategory = "narrow"
HipWidthAverage HipWidthCategory = "average"
HipWidthWide HipWidthCategory = "wide"
)
// Leg length categories
type LegLengthCategory string
const (
LegLengthShort LegLengthCategory = "short"
LegLengthProportional LegLengthCategory = "proportional"
LegLengthLong LegLengthCategory = "long"
)
// Torso length categories
type TorsoLengthCategory string
const (
TorsoLengthShort TorsoLengthCategory = "short"
TorsoLengthProportional TorsoLengthCategory = "proportional"
TorsoLengthLong TorsoLengthCategory = "long"
)
// Bust size categories
type BustSizeCategory string
const (
BustSizeSmall BustSizeCategory = "small"
BustSizeMedium BustSizeCategory = "medium"
BustSizeLarge BustSizeCategory = "large"
BustSizeVeryLarge BustSizeCategory = "very_large"
)
// Posture categories
type PostureCategory string
const (
PostureUpright PostureCategory = "upright"
PostureRelaxed PostureCategory = "relaxed"
PostureConfident PostureCategory = "confident"
PostureAthletic PostureCategory = "athletic"
)