Import current DEMON v0.19 source, assets and development handoff
This commit is contained in:
@@ -0,0 +1,191 @@
|
||||
extends RefCounted
|
||||
# Original procedural 3D characters, based on the approved caricature direction.
|
||||
var g
|
||||
const SKINS = ["e7aa7e","bda182","d6a080","e4ac7d","edb48e","cba087","edb48e","d6a074","cfaa96","ddac8d"]
|
||||
const CLOTHES = ["ded1aa","85715c","b49a77","263044","b62f52","6a6c45","a74f94","e6dcc1","60395f","283344"]
|
||||
const HAIR = ["6e3425","45392e","30272a","38282a","d6a451","777368","ed72ac","ad482a","b4a5b2","4a3028"]
|
||||
|
||||
func build(game, demon: bool, kind = 0):
|
||||
g = game
|
||||
var sculpt=preload("res://hero.gd").new()
|
||||
sculpt.g=g
|
||||
var r = Node3D.new()
|
||||
var skin = Color("cc748e") if demon else Color(SKINS[kind])
|
||||
var cloth = Color("382439") if demon else Color(CLOTHES[kind])
|
||||
var hair = Color("502132") if demon else Color(HAIR[kind])
|
||||
var female = demon or kind in [4,6,8]
|
||||
var fat = not demon and kind in [0,3]
|
||||
var slim = not demon and kind in [1,2,5]
|
||||
var old = not demon and kind==8
|
||||
var width = 0.58 if fat else (0.33 if slim else 0.39)
|
||||
var belly = 0.43 if fat else 0.25
|
||||
var hip = 0.44 if fat else 0.30
|
||||
var head_y = 1.93 if not old else 1.78
|
||||
# Boots / trouser legs are separate pivots so gait is visible from above.
|
||||
for side in [-1,1]:
|
||||
var leg = Node3D.new()
|
||||
r.add_child(leg)
|
||||
leg.name = "LegL" if side<0 else "LegR"
|
||||
leg.position = Vector3(side*hip*0.57,0.87,0)
|
||||
var pants = Color("201b29") if demon else (skin if female and not old else cloth.darkened(0.30))
|
||||
sculpt.tube(leg,[Vector3(0,0.06,0),Vector3(0,-0.20,0),Vector3(0,-0.39,0)],[0.16 if fat else 0.13,0.14 if fat else 0.115,0.12 if fat else 0.10],pants)
|
||||
g.line(leg,Vector3(0,-0.36,0),Vector3(0,-0.72,0.02),0.10 if not fat else 0.13,Color("251e2c") if demon else pants)
|
||||
g.ball(leg,Vector3(0,-0.74,0.12),Vector3(0.24,0.20,0.43),Color("24212b"))
|
||||
if demon or kind==4:
|
||||
g.box(leg,Vector3(0,-0.83,-0.04),Vector3(0.08,0.15,0.10),Color("c18e62"))
|
||||
if demon:
|
||||
g.cylinder(leg,Vector3(0,-0.25,0),0.12,0.12,Color("9b4967"))
|
||||
if kind==9 and not demon:
|
||||
g.box(leg,Vector3(0,-0.79,0.12),Vector3(0.26,0.07,0.43),Color("cfbfa9"))
|
||||
sculpt.loft(r,Vector3.ZERO,[[0.75,hip,belly*0.8,0],[0.88,width*0.85,belly*0.95,0],[1.09,width,belly,0],[1.29,width*0.94,belly*0.91,0],[1.46,width*0.87,belly*0.68,0],[1.57,0.18,0.14,0]],cloth)
|
||||
if demon or (female and not old):
|
||||
g.cylinder(r,Vector3(0,0.86,0),0.36,0.33,cloth,0.24)
|
||||
g.ball(r,Vector3(0,1.49,0.01),Vector3(0.64,0.28,0.4),skin)
|
||||
g.box(r,Vector3(0,1.38,0.26),Vector3(0.36,0.23,0.06),cloth)
|
||||
for y in [1.10,1.20,1.30]:
|
||||
g.line(r,Vector3(-0.07,y,0.285),Vector3(0.07,y+0.07,0.285),0.012,Color("d7aa6b"))
|
||||
g.line(r,Vector3(0.07,y,0.285),Vector3(-0.07,y+0.07,0.285),0.012,Color("d7aa6b"))
|
||||
if fat:
|
||||
g.ball(r,Vector3(0,1.06,0.20),Vector3(width*1.9,0.75,0.82),skin if kind==0 else cloth)
|
||||
g.cylinder(r,Vector3(0,0.84,0),width*0.83,0.08,Color("35282a"))
|
||||
g.box(r,Vector3(0,0.86,belly+0.025),Vector3(0.15,0.13,0.055),Color("cf9952"))
|
||||
var head=Node3D.new();r.add_child(head)
|
||||
head.scale=Vector3(0.78,0.82,0.82);head.position.y=0.29
|
||||
g.cylinder(head,Vector3(0,head_y-0.32,0),0.13,0.18,skin)
|
||||
# Jaw, oversized nose, eyebrows and large high-contrast eyes.
|
||||
var face_width=0.37 if fat else (0.25 if slim else 0.30)
|
||||
sculpt.loft(head,Vector3(0,head_y,0),[[-0.32,0.09,0.10,0.04],[-0.24,face_width*0.68,0.18,0.035],[-0.10,face_width,0.26,0.015],[0.05,face_width,0.27,0],[0.20,face_width*0.91,0.24,-0.01],[0.31,face_width*0.60,0.18,-0.02],[0.35,0.04,0.06,-0.02]],skin)
|
||||
g.ball(head,Vector3(0,head_y-0.04,0.33),Vector3(0.13 if not fat else 0.17,0.17,0.17),skin.lightened(0.05))
|
||||
for side in [-1,1]:
|
||||
g.ball(head,Vector3(side*0.32,head_y-0.02,0),Vector3(0.14,0.22,0.15),skin)
|
||||
g.ball(head,Vector3(side*0.145,head_y+0.075,0.262),Vector3(0.15,0.10,0.06),Color("fff0d8"))
|
||||
g.ball(head,Vector3(side*0.145,head_y+0.065,0.306),Vector3(0.055,0.07,0.022),Color("542c35") if demon else Color("28313a"))
|
||||
g.ball(head,Vector3(side*0.145-0.016,head_y+0.09,0.325),Vector3(0.028,0.032,0.02),Color("ffffff"))
|
||||
var brow=g.box(head,Vector3(side*0.145,head_y+0.19,0.27),Vector3(0.23,0.055,0.065),hair)
|
||||
brow.rotation.z=side*(-0.20 if demon or kind in [2,8] else 0.13)
|
||||
g.ball(head,Vector3(0,head_y-0.19,0.319),Vector3(0.21,0.045,0.03),Color("6d2539"))
|
||||
# Sculpted clumps keep hairstyles distinct at gameplay distance.
|
||||
sculpt.loft(head,Vector3(0,head_y,-0.045),[[0.19,0.32,0.245,-0.025],[0.30,0.29,0.23,-0.01],[0.39,0.20,0.17,0],[0.41,0.03,0.05,0]],hair)
|
||||
for k in range(5):
|
||||
var lock=g.ball(head,Vector3(-0.25+k*0.12,head_y+0.27,0.12),Vector3(0.20,0.29,0.30),hair.lightened(0.025*k))
|
||||
lock.rotation.z=-0.30+k*0.13
|
||||
if female or demon:
|
||||
for side in [-1,1]:
|
||||
var lock=g.ball(head,Vector3(side*0.27,head_y-0.16,-0.13),Vector3(0.24,0.72,0.32),hair)
|
||||
lock.rotation.z=side*0.18
|
||||
if kind==7 and not demon:
|
||||
for k in range(3):
|
||||
var quiff=g.ball(head,Vector3(-0.14+k*0.13,head_y+0.42,0.08),Vector3(0.22,0.42,0.29),hair)
|
||||
quiff.rotation.z=-0.55
|
||||
if (kind in [1,5]) and not demon:
|
||||
g.ball(head,Vector3(0,head_y-0.22,0.19),Vector3(0.48,0.29,0.31),hair)
|
||||
g.ball(head,Vector3(0,head_y-0.16,0.36),Vector3(0.23,0.065,0.04),Color("563f36"))
|
||||
# Arms and hands, posed around each person's recognisable prop.
|
||||
for side in [-1,1]:
|
||||
var arm=Node3D.new()
|
||||
r.add_child(arm)
|
||||
arm.name="ArmL" if side<0 else "ArmR"
|
||||
arm.position=Vector3(side*(width+0.03),1.47,0)
|
||||
var elbow=Vector3(side*0.10,-0.30,0.10)
|
||||
var hand=Vector3(side*0.04,-0.42,0.28)
|
||||
sculpt.tube(arm,[Vector3(0,0.03,0),elbow*0.55,elbow],[0.15 if fat else 0.12,0.13 if fat else 0.10,0.10 if fat else 0.08],skin if demon or kind in [0,1,2,4,6,7] else cloth)
|
||||
g.ball(arm,elbow,Vector3.ONE*(0.21 if fat else 0.17),skin)
|
||||
g.line(arm,elbow,hand,0.10 if fat else 0.08,Color("302335") if demon else skin)
|
||||
g.ball(arm,hand,Vector3(0.17,0.19,0.17),skin)
|
||||
if demon:
|
||||
for side in [-1,1]:
|
||||
var horn=g.cylinder(r,Vector3(side*0.23,head_y+0.52,-0.05),0.13,0.45,Color("ca5371"),0)
|
||||
horn.rotation.z=-side*0.32
|
||||
g.cylinder(r,Vector3(side*0.23,head_y+0.36,-0.05),0.13,0.07,Color("d7a354"))
|
||||
wing(r,side)
|
||||
g.line(r,Vector3(0,1,-0.24),Vector3(0.43,0.80,-0.67),0.045,skin)
|
||||
g.line(r,Vector3(0.43,0.80,-0.67),Vector3(0.74,1.12,-0.63),0.045,skin)
|
||||
g.cylinder(r,Vector3(0.74,1.20,-0.63),0.13,0.27,Color("c54c6b"),0)
|
||||
g.box(r,Vector3(0.23,1.4,0.25),Vector3(0.12,0.16,0.025),Color("e9caa0"))
|
||||
g.line(r,Vector3(0.51,1.05,0.3),Vector3(0.64,0.62,0.38),0.035,Color("412b30"))
|
||||
g.ball(r,Vector3(0.66,0.57,0.40),Vector3(0.19,0.13,0.08),Color("a1465b"))
|
||||
else:
|
||||
accessory(r,kind,head_y,width,head)
|
||||
r.rotation.y = 0.58
|
||||
return r
|
||||
|
||||
func wing(r, side):
|
||||
var st=SurfaceTool.new()
|
||||
st.begin(Mesh.PRIMITIVE_TRIANGLES)
|
||||
var points=[Vector3(side*0.20,1.58,-0.23),Vector3(side*0.85,1.91,-0.40),Vector3(side*1.05,1.32,-0.32),Vector3(side*0.68,1.42,-0.36),Vector3(side*0.56,1.04,-0.26),Vector3(side*0.36,1.27,-0.25)]
|
||||
for i in range(1,points.size()-1):
|
||||
for p in [points[0],points[i],points[i+1]]: st.add_vertex(p)
|
||||
st.generate_normals()
|
||||
var n=MeshInstance3D.new()
|
||||
n.mesh=st.commit()
|
||||
var m=g.mat(Color("79354e"))
|
||||
m.cull_mode=BaseMaterial3D.CULL_DISABLED
|
||||
n.material_override=m
|
||||
r.add_child(n)
|
||||
for p in [points[1],points[2],points[4]]: g.line(r,points[0],p,0.025,Color("b35b73"))
|
||||
|
||||
func accessory(r, k, hy, w, head):
|
||||
var gold=Color("d8a64d")
|
||||
match k:
|
||||
0:
|
||||
g.line(r,Vector3(-w,1.07,0.35),Vector3(-w-0.08,1.43,0.38),0.045,Color("dbc3a0"))
|
||||
g.ball(r,Vector3(-w-0.09,1.55,0.38),Vector3(0.36,0.45,0.32),Color("b45c30"))
|
||||
for i in range(5): g.ball(r,Vector3(-0.30+i*0.13,1.36-i%2*0.13,0.53),Vector3(0.09,0.10,0.025),Color("aa753d"))
|
||||
1:
|
||||
g.line(head,Vector3(0.16,hy-0.17,0.36),Vector3(0.45,hy-0.20,0.49),0.025,Color("e5cfb4"))
|
||||
g.ball(head,Vector3(0.45,hy-0.20,0.49),Vector3(0.055,0.05,0.055),Color("fa8b47"))
|
||||
for i in range(3): g.ball(head,Vector3(0.48+i*0.08,hy+0.02+i*0.19,0.48),Vector3.ONE*(0.10+i*0.06),Color("938b9c"))
|
||||
2:
|
||||
g.box(r,Vector3(0,1.14,0.30),Vector3(0.56,0.64,0.05),Color("a18c65"))
|
||||
g.line(r,Vector3(w+0.03,1.07,0.3),Vector3(w+0.12,1.27,0.32),0.05,Color("4c3431"))
|
||||
g.box(r,Vector3(w+0.22,1.48,0.33),Vector3(0.39,0.38,0.06),Color("a5b4b6"))
|
||||
g.ball(r,Vector3(w+0.28,1.60,0.37),Vector3(0.06,0.06,0.01),Color("3d4750"))
|
||||
3:
|
||||
glasses(head,hy)
|
||||
g.box(r,Vector3(0,1.30,0.53),Vector3(0.09,0.36,0.06),Color("c1474e"))
|
||||
g.box(r,Vector3(-w,0.73,0.28),Vector3(0.56,0.4,0.23),Color("352930"))
|
||||
for i in range(3):
|
||||
var bill=g.box(r,Vector3(w+0.05+i*0.04,1.15+i*0.04,0.35),Vector3(0.18,0.34,0.025),Color("718e58"))
|
||||
bill.rotation.z=-0.2+i*0.18
|
||||
4:
|
||||
phone(r,Vector3(w+0.07,1.32,0.37),Color("d96493"))
|
||||
g.ball(r,Vector3(0,1.51,0.24),Vector3(0.07,0.11,0.05),gold)
|
||||
6:
|
||||
g.line(r,Vector3(-w,1.04,0.32),Vector3(-w-0.1,2.25,0.37),0.025,Color("342b37"))
|
||||
phone(r,Vector3(-w-0.1,2.36,0.37),Color("db67a7"))
|
||||
for side in [-1,1]: g.ball(head,Vector3(side*0.3,hy+0.38,-0.06),Vector3.ONE*0.28,Color("ef80ba"))
|
||||
g.box(r,Vector3(w+0.13,0.88,0.07),Vector3(0.30,0.29,0.19),Color("e67fa8"))
|
||||
5:
|
||||
g.cylinder(r,Vector3(-w-0.04,0.99,0.32),0.10,0.38,Color("3c684f"))
|
||||
g.cylinder(r,Vector3(-w-0.04,1.24,0.32),0.043,0.16,Color("3c684f"))
|
||||
g.box(r,Vector3(-w-0.04,0.99,0.421),Vector3(0.14,0.14,0.02),Color("d6c698"))
|
||||
7:
|
||||
glasses(head,hy)
|
||||
g.torus(r,Vector3(0,1.52,0.05),0.22,gold).rotation.x=0.45
|
||||
g.ball(r,Vector3(0,1.24,0.31),Vector3(0.12,0.15,0.04),gold)
|
||||
phone(r,Vector3(-w-0.03,1.27,0.37),Color("714951"))
|
||||
8:
|
||||
for i in range(6):
|
||||
var a=i*TAU/6
|
||||
var roller=g.cylinder(head,Vector3(cos(a)*0.27,hy+0.28,sin(a)*0.24),0.09,0.18,Color("c785a6"))
|
||||
roller.rotation.x=PI/2
|
||||
glasses(head,hy,false)
|
||||
g.cylinder(r,Vector3(0,0.85,0),0.43,0.68,Color("60395f"),0.31)
|
||||
for i in range(6): g.ball(r,Vector3(-0.24+i%3*0.24,0.68+floori(i/3.0)*0.3,0.37),Vector3(0.09,0.10,0.025),Color("b8956b"))
|
||||
9:
|
||||
g.box(r,Vector3(0,1.01,0.55),Vector3(0.65,0.06,0.43),Color("41424f"))
|
||||
var screen=g.box(r,Vector3(0,1.25,0.75),Vector3(0.65,0.44,0.05),Color("41424f"))
|
||||
screen.rotation.x=-0.15
|
||||
g.ball(r,Vector3(0,1.25,0.79),Vector3(0.13,0.14,0.015),Color("baaac3"))
|
||||
for side in [-1,1]: g.ball(head,Vector3(side*0.34,hy,0),Vector3(0.16,0.25,0.22),Color("252735"))
|
||||
g.torus(head,Vector3(0,hy+0.03,0),0.35,Color("252735")).rotation.x=PI/2
|
||||
|
||||
func phone(r,p,c):
|
||||
g.box(r,p,Vector3(0.20,0.34,0.055),c)
|
||||
g.box(r,p+Vector3(0,0,0.032),Vector3(0.15,0.25,0.01),Color("a5d3d3"))
|
||||
|
||||
func glasses(r,hy,dark=true):
|
||||
for side in [-1,1]:
|
||||
g.box(r,Vector3(side*0.16,hy+0.08,0.322),Vector3(0.25,0.17,0.055),Color("242333"))
|
||||
if not dark: g.box(r,Vector3(side*0.16,hy+0.08,0.355),Vector3(0.18,0.10,0.02),Color("bdc9be"))
|
||||
g.line(r,Vector3(-0.06,hy+0.10,0.35),Vector3(0.06,hy+0.10,0.35),0.025,Color("242333"))
|
||||
Reference in New Issue
Block a user