|
@@ -21,9 +21,9 @@ namespace Render::GL {
|
|
|
using Render::Geom::clamp01;
|
|
using Render::Geom::clamp01;
|
|
|
using Render::Geom::clampf;
|
|
using Render::Geom::clampf;
|
|
|
using Render::Geom::clampVec01;
|
|
using Render::Geom::clampVec01;
|
|
|
-using Render::Geom::coneFromTo;
|
|
|
|
|
-using Render::Geom::cylinderBetween;
|
|
|
|
|
-using Render::Geom::sphereAt;
|
|
|
|
|
|
|
+using Render::Geom::cone_from_to;
|
|
|
|
|
+using Render::Geom::cylinder_between;
|
|
|
|
|
+using Render::Geom::sphere_at;
|
|
|
|
|
|
|
|
struct HumanProportions {
|
|
struct HumanProportions {
|
|
|
|
|
|
|
@@ -149,14 +149,14 @@ static inline void drawTorso(const DrawContext &p, ISubmitter &out,
|
|
|
float torso_radius = HP::TORSO_TOP_R;
|
|
float torso_radius = HP::TORSO_TOP_R;
|
|
|
|
|
|
|
|
out.mesh(getUnitCylinder(),
|
|
out.mesh(getUnitCylinder(),
|
|
|
- cylinderBetween(p.model, torso_top, torsoBot, torso_radius), C.tunic,
|
|
|
|
|
|
|
+ cylinder_between(p.model, torso_top, torsoBot, torso_radius), C.tunic,
|
|
|
nullptr, 1.0F);
|
|
nullptr, 1.0F);
|
|
|
|
|
|
|
|
QVector3D waist{0.0F, HP::WAIST_Y, 0.0F};
|
|
QVector3D waist{0.0F, HP::WAIST_Y, 0.0F};
|
|
|
QVector3D hipCenter = (P.hipL + P.hipR) * 0.5F;
|
|
QVector3D hipCenter = (P.hipL + P.hipR) * 0.5F;
|
|
|
|
|
|
|
|
out.mesh(getUnitCone(),
|
|
out.mesh(getUnitCone(),
|
|
|
- coneFromTo(p.model, waist, hipCenter, HP::TORSO_BOT_R),
|
|
|
|
|
|
|
+ cone_from_to(p.model, waist, hipCenter, HP::TORSO_BOT_R),
|
|
|
C.tunic * 0.9F, nullptr, 1.0F);
|
|
C.tunic * 0.9F, nullptr, 1.0F);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -166,10 +166,10 @@ static inline void drawHeadAndNeck(const DrawContext &p, ISubmitter &out,
|
|
|
|
|
|
|
|
QVector3D chin_pos{0.0F, HP::CHIN_Y, 0.0F};
|
|
QVector3D chin_pos{0.0F, HP::CHIN_Y, 0.0F};
|
|
|
out.mesh(getUnitCylinder(),
|
|
out.mesh(getUnitCylinder(),
|
|
|
- cylinderBetween(p.model, P.neck_base, chin_pos, HP::NECK_RADIUS),
|
|
|
|
|
|
|
+ cylinder_between(p.model, P.neck_base, chin_pos, HP::NECK_RADIUS),
|
|
|
C.skin * 0.9F, nullptr, 1.0F);
|
|
C.skin * 0.9F, nullptr, 1.0F);
|
|
|
|
|
|
|
|
- out.mesh(getUnitSphere(), sphereAt(p.model, P.head_pos, P.head_r), C.skin,
|
|
|
|
|
|
|
+ out.mesh(getUnitSphere(), sphere_at(p.model, P.head_pos, P.head_r), C.skin,
|
|
|
nullptr, 1.0F);
|
|
nullptr, 1.0F);
|
|
|
|
|
|
|
|
QVector3D iris(0.06F, 0.06F, 0.07F);
|
|
QVector3D iris(0.06F, 0.06F, 0.07F);
|
|
@@ -178,23 +178,23 @@ static inline void drawHeadAndNeck(const DrawContext &p, ISubmitter &out,
|
|
|
float eye_spacing = P.head_r * 0.35F;
|
|
float eye_spacing = P.head_r * 0.35F;
|
|
|
out.mesh(getUnitSphere(),
|
|
out.mesh(getUnitSphere(),
|
|
|
p.model *
|
|
p.model *
|
|
|
- sphereAt(QVector3D(-eye_spacing, eyeY, eyeZ), P.head_r * 0.15F),
|
|
|
|
|
|
|
+ sphere_at(QVector3D(-eye_spacing, eyeY, eyeZ), P.head_r * 0.15F),
|
|
|
iris, nullptr, 1.0F);
|
|
iris, nullptr, 1.0F);
|
|
|
out.mesh(getUnitSphere(),
|
|
out.mesh(getUnitSphere(),
|
|
|
p.model *
|
|
p.model *
|
|
|
- sphereAt(QVector3D(eye_spacing, eyeY, eyeZ), P.head_r * 0.15F),
|
|
|
|
|
|
|
+ sphere_at(QVector3D(eye_spacing, eyeY, eyeZ), P.head_r * 0.15F),
|
|
|
iris, nullptr, 1.0F);
|
|
iris, nullptr, 1.0F);
|
|
|
|
|
|
|
|
QVector3D domeC = P.head_pos + QVector3D(0.0F, P.head_r * 0.25F, 0.0F);
|
|
QVector3D domeC = P.head_pos + QVector3D(0.0F, P.head_r * 0.25F, 0.0F);
|
|
|
float domeR = P.head_r * 1.05F;
|
|
float domeR = P.head_r * 1.05F;
|
|
|
- out.mesh(getUnitSphere(), sphereAt(p.model, domeC, domeR), C.metal, nullptr,
|
|
|
|
|
|
|
+ out.mesh(getUnitSphere(), sphere_at(p.model, domeC, domeR), C.metal, nullptr,
|
|
|
1.0F);
|
|
1.0F);
|
|
|
|
|
|
|
|
QVector3D visorBase(0.0F, P.head_pos.y() + P.head_r * 0.10F,
|
|
QVector3D visorBase(0.0F, P.head_pos.y() + P.head_r * 0.10F,
|
|
|
P.head_r * 0.80F);
|
|
P.head_r * 0.80F);
|
|
|
QVector3D visorTip = visorBase + QVector3D(0.0F, -0.015F, 0.06F);
|
|
QVector3D visorTip = visorBase + QVector3D(0.0F, -0.015F, 0.06F);
|
|
|
out.mesh(getUnitCone(),
|
|
out.mesh(getUnitCone(),
|
|
|
- coneFromTo(p.model, visorBase, visorTip, P.head_r * 0.38F),
|
|
|
|
|
|
|
+ cone_from_to(p.model, visorBase, visorTip, P.head_r * 0.38F),
|
|
|
C.metal * 0.92F, nullptr, 1.0F);
|
|
C.metal * 0.92F, nullptr, 1.0F);
|
|
|
|
|
|
|
|
QVector3D cheekL0(-P.head_r * 0.85F, P.head_pos.y() + P.head_r * 0.05F,
|
|
QVector3D cheekL0(-P.head_r * 0.85F, P.head_pos.y() + P.head_r * 0.05F,
|
|
@@ -206,10 +206,10 @@ static inline void drawHeadAndNeck(const DrawContext &p, ISubmitter &out,
|
|
|
QVector3D cheekR1(P.head_r * 0.85F, P.head_pos.y() - P.head_r * 0.20F,
|
|
QVector3D cheekR1(P.head_r * 0.85F, P.head_pos.y() - P.head_r * 0.20F,
|
|
|
-0.04F);
|
|
-0.04F);
|
|
|
out.mesh(getUnitCone(),
|
|
out.mesh(getUnitCone(),
|
|
|
- coneFromTo(p.model, cheekL0, cheekL1, P.head_r * 0.24F),
|
|
|
|
|
|
|
+ cone_from_to(p.model, cheekL0, cheekL1, P.head_r * 0.24F),
|
|
|
C.metal * 0.95F, nullptr, 1.0F);
|
|
C.metal * 0.95F, nullptr, 1.0F);
|
|
|
out.mesh(getUnitCone(),
|
|
out.mesh(getUnitCone(),
|
|
|
- coneFromTo(p.model, cheekR0, cheekR1, P.head_r * 0.24F),
|
|
|
|
|
|
|
+ cone_from_to(p.model, cheekR0, cheekR1, P.head_r * 0.24F),
|
|
|
C.metal * 0.95F, nullptr, 1.0F);
|
|
C.metal * 0.95F, nullptr, 1.0F);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -222,25 +222,25 @@ static inline void draw_arms(const DrawContext &p, ISubmitter &out,
|
|
|
const float joint_r = upper_arm_r * 1.2F;
|
|
const float joint_r = upper_arm_r * 1.2F;
|
|
|
|
|
|
|
|
out.mesh(getUnitCylinder(),
|
|
out.mesh(getUnitCylinder(),
|
|
|
- cylinderBetween(p.model, P.shoulder_l, P.elbow_l, upper_arm_r),
|
|
|
|
|
|
|
+ cylinder_between(p.model, P.shoulder_l, P.elbow_l, upper_arm_r),
|
|
|
C.tunic, nullptr, 1.0F);
|
|
C.tunic, nullptr, 1.0F);
|
|
|
|
|
|
|
|
- out.mesh(getUnitSphere(), sphereAt(p.model, P.elbow_l, joint_r),
|
|
|
|
|
|
|
+ out.mesh(getUnitSphere(), sphere_at(p.model, P.elbow_l, joint_r),
|
|
|
C.tunic * 0.95F, nullptr, 1.0F);
|
|
C.tunic * 0.95F, nullptr, 1.0F);
|
|
|
|
|
|
|
|
out.mesh(getUnitCylinder(),
|
|
out.mesh(getUnitCylinder(),
|
|
|
- cylinderBetween(p.model, P.elbow_l, P.hand_l, fore_arm_r),
|
|
|
|
|
|
|
+ cylinder_between(p.model, P.elbow_l, P.hand_l, fore_arm_r),
|
|
|
C.skin * 0.95F, nullptr, 1.0F);
|
|
C.skin * 0.95F, nullptr, 1.0F);
|
|
|
|
|
|
|
|
out.mesh(getUnitCylinder(),
|
|
out.mesh(getUnitCylinder(),
|
|
|
- cylinderBetween(p.model, P.shoulder_r, P.elbow_r, upper_arm_r),
|
|
|
|
|
|
|
+ cylinder_between(p.model, P.shoulder_r, P.elbow_r, upper_arm_r),
|
|
|
C.tunic, nullptr, 1.0F);
|
|
C.tunic, nullptr, 1.0F);
|
|
|
|
|
|
|
|
- out.mesh(getUnitSphere(), sphereAt(p.model, P.elbow_r, joint_r),
|
|
|
|
|
|
|
+ out.mesh(getUnitSphere(), sphere_at(p.model, P.elbow_r, joint_r),
|
|
|
C.tunic * 0.95F, nullptr, 1.0F);
|
|
C.tunic * 0.95F, nullptr, 1.0F);
|
|
|
|
|
|
|
|
out.mesh(getUnitCylinder(),
|
|
out.mesh(getUnitCylinder(),
|
|
|
- cylinderBetween(p.model, P.elbow_r, P.hand_r, fore_arm_r),
|
|
|
|
|
|
|
+ cylinder_between(p.model, P.elbow_r, P.hand_r, fore_arm_r),
|
|
|
C.skin * 0.95F, nullptr, 1.0F);
|
|
C.skin * 0.95F, nullptr, 1.0F);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -265,27 +265,27 @@ static inline void draw_legs(const DrawContext &p, ISubmitter &out,
|
|
|
QVector3D knee_l = makeKnee(P.hipL, P.foot_l, -1.0F);
|
|
QVector3D knee_l = makeKnee(P.hipL, P.foot_l, -1.0F);
|
|
|
QVector3D knee_r = makeKnee(P.hipR, P.foot_r, 1.0F);
|
|
QVector3D knee_r = makeKnee(P.hipR, P.foot_r, 1.0F);
|
|
|
|
|
|
|
|
- out.mesh(getUnitCone(), coneFromTo(p.model, P.hipL, knee_l, thighR),
|
|
|
|
|
|
|
+ out.mesh(getUnitCone(), cone_from_to(p.model, P.hipL, knee_l, thighR),
|
|
|
C.leather, nullptr, 1.0F);
|
|
C.leather, nullptr, 1.0F);
|
|
|
- out.mesh(getUnitCone(), coneFromTo(p.model, P.hipR, knee_r, thighR),
|
|
|
|
|
|
|
+ out.mesh(getUnitCone(), cone_from_to(p.model, P.hipR, knee_r, thighR),
|
|
|
C.leather, nullptr, 1.0F);
|
|
C.leather, nullptr, 1.0F);
|
|
|
|
|
|
|
|
- out.mesh(getUnitSphere(), sphereAt(p.model, knee_l, kneeJointR),
|
|
|
|
|
|
|
+ out.mesh(getUnitSphere(), sphere_at(p.model, knee_l, kneeJointR),
|
|
|
C.leather * 0.95F, nullptr, 1.0F);
|
|
C.leather * 0.95F, nullptr, 1.0F);
|
|
|
- out.mesh(getUnitSphere(), sphereAt(p.model, knee_r, kneeJointR),
|
|
|
|
|
|
|
+ out.mesh(getUnitSphere(), sphere_at(p.model, knee_r, kneeJointR),
|
|
|
C.leather * 0.95F, nullptr, 1.0F);
|
|
C.leather * 0.95F, nullptr, 1.0F);
|
|
|
|
|
|
|
|
- out.mesh(getUnitCone(), coneFromTo(p.model, knee_l, P.foot_l, shinR),
|
|
|
|
|
|
|
+ out.mesh(getUnitCone(), cone_from_to(p.model, knee_l, P.foot_l, shinR),
|
|
|
C.leatherDark, nullptr, 1.0F);
|
|
C.leatherDark, nullptr, 1.0F);
|
|
|
- out.mesh(getUnitCone(), coneFromTo(p.model, knee_r, P.foot_r, shinR),
|
|
|
|
|
|
|
+ out.mesh(getUnitCone(), cone_from_to(p.model, knee_r, P.foot_r, shinR),
|
|
|
C.leatherDark, nullptr, 1.0F);
|
|
C.leatherDark, nullptr, 1.0F);
|
|
|
|
|
|
|
|
QVector3D down(0.0F, -0.02F, 0.0F);
|
|
QVector3D down(0.0F, -0.02F, 0.0F);
|
|
|
out.mesh(getUnitCylinder(),
|
|
out.mesh(getUnitCylinder(),
|
|
|
- cylinderBetween(p.model, P.foot_l, P.foot_l + down, shinR * 1.1F),
|
|
|
|
|
|
|
+ cylinder_between(p.model, P.foot_l, P.foot_l + down, shinR * 1.1F),
|
|
|
C.leatherDark, nullptr, 1.0F);
|
|
C.leatherDark, nullptr, 1.0F);
|
|
|
out.mesh(getUnitCylinder(),
|
|
out.mesh(getUnitCylinder(),
|
|
|
- cylinderBetween(p.model, P.foot_r, P.foot_r + down, shinR * 1.1F),
|
|
|
|
|
|
|
+ cylinder_between(p.model, P.foot_r, P.foot_r + down, shinR * 1.1F),
|
|
|
C.leatherDark, nullptr, 1.0F);
|
|
C.leatherDark, nullptr, 1.0F);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -298,24 +298,24 @@ static inline void drawQuiver(const DrawContext &p, ISubmitter &out,
|
|
|
QVector3D q_base(-0.10F, HP::CHEST_Y, -0.22F);
|
|
QVector3D q_base(-0.10F, HP::CHEST_Y, -0.22F);
|
|
|
|
|
|
|
|
float quiver_r = HP::HEAD_RADIUS * 0.45F;
|
|
float quiver_r = HP::HEAD_RADIUS * 0.45F;
|
|
|
- out.mesh(getUnitCylinder(), cylinderBetween(p.model, q_base, qTop, quiver_r),
|
|
|
|
|
|
|
+ out.mesh(getUnitCylinder(), cylinder_between(p.model, q_base, qTop, quiver_r),
|
|
|
C.leather, nullptr, 1.0F);
|
|
C.leather, nullptr, 1.0F);
|
|
|
|
|
|
|
|
float j = (hash_01(seed) - 0.5F) * 0.04F;
|
|
float j = (hash_01(seed) - 0.5F) * 0.04F;
|
|
|
float k = (hash_01(seed ^ HashXorShift::k_golden_ratio) - 0.5F) * 0.04F;
|
|
float k = (hash_01(seed ^ HashXorShift::k_golden_ratio) - 0.5F) * 0.04F;
|
|
|
|
|
|
|
|
QVector3D a1 = qTop + QVector3D(0.00F + j, 0.08F, 0.00F + k);
|
|
QVector3D a1 = qTop + QVector3D(0.00F + j, 0.08F, 0.00F + k);
|
|
|
- out.mesh(getUnitCylinder(), cylinderBetween(p.model, qTop, a1, 0.010F),
|
|
|
|
|
|
|
+ out.mesh(getUnitCylinder(), cylinder_between(p.model, qTop, a1, 0.010F),
|
|
|
C.wood, nullptr, 1.0F);
|
|
C.wood, nullptr, 1.0F);
|
|
|
out.mesh(getUnitCone(),
|
|
out.mesh(getUnitCone(),
|
|
|
- coneFromTo(p.model, a1, a1 + QVector3D(0, 0.05F, 0), 0.025F),
|
|
|
|
|
|
|
+ cone_from_to(p.model, a1, a1 + QVector3D(0, 0.05F, 0), 0.025F),
|
|
|
C.fletch, nullptr, 1.0F);
|
|
C.fletch, nullptr, 1.0F);
|
|
|
|
|
|
|
|
QVector3D a2 = qTop + QVector3D(0.02F - j, 0.07F, 0.02F - k);
|
|
QVector3D a2 = qTop + QVector3D(0.02F - j, 0.07F, 0.02F - k);
|
|
|
- out.mesh(getUnitCylinder(), cylinderBetween(p.model, qTop, a2, 0.010F),
|
|
|
|
|
|
|
+ out.mesh(getUnitCylinder(), cylinder_between(p.model, qTop, a2, 0.010F),
|
|
|
C.wood, nullptr, 1.0F);
|
|
C.wood, nullptr, 1.0F);
|
|
|
out.mesh(getUnitCone(),
|
|
out.mesh(getUnitCone(),
|
|
|
- coneFromTo(p.model, a2, a2 + QVector3D(0, 0.05F, 0), 0.025F),
|
|
|
|
|
|
|
+ cone_from_to(p.model, a2, a2 + QVector3D(0, 0.05F, 0), 0.025F),
|
|
|
C.fletch, nullptr, 1.0F);
|
|
C.fletch, nullptr, 1.0F);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -343,36 +343,36 @@ static inline void drawBowAndArrow(const DrawContext &p, ISubmitter &out,
|
|
|
for (int i = 1; i <= k_bow_curve_segments; ++i) {
|
|
for (int i = 1; i <= k_bow_curve_segments; ++i) {
|
|
|
float t = float(i) / float(k_bow_curve_segments);
|
|
float t = float(i) / float(k_bow_curve_segments);
|
|
|
QVector3D cur = q_bezier(bot_end, ctrl, top_end, t);
|
|
QVector3D cur = q_bezier(bot_end, ctrl, top_end, t);
|
|
|
- out.mesh(getUnitCylinder(), cylinderBetween(p.model, prev, cur, P.bowRodR),
|
|
|
|
|
|
|
+ out.mesh(getUnitCylinder(), cylinder_between(p.model, prev, cur, P.bowRodR),
|
|
|
C.wood, nullptr, 1.0F);
|
|
C.wood, nullptr, 1.0F);
|
|
|
prev = cur;
|
|
prev = cur;
|
|
|
}
|
|
}
|
|
|
out.mesh(getUnitCylinder(),
|
|
out.mesh(getUnitCylinder(),
|
|
|
- cylinderBetween(p.model, grip - up * 0.05F, grip + up * 0.05F,
|
|
|
|
|
|
|
+ cylinder_between(p.model, grip - up * 0.05F, grip + up * 0.05F,
|
|
|
P.bowRodR * 1.45F),
|
|
P.bowRodR * 1.45F),
|
|
|
C.wood, nullptr, 1.0F);
|
|
C.wood, nullptr, 1.0F);
|
|
|
|
|
|
|
|
out.mesh(getUnitCylinder(),
|
|
out.mesh(getUnitCylinder(),
|
|
|
- cylinderBetween(p.model, top_end, nock, P.stringR), C.stringCol,
|
|
|
|
|
|
|
+ cylinder_between(p.model, top_end, nock, P.stringR), C.stringCol,
|
|
|
nullptr, 1.0F);
|
|
nullptr, 1.0F);
|
|
|
out.mesh(getUnitCylinder(),
|
|
out.mesh(getUnitCylinder(),
|
|
|
- cylinderBetween(p.model, nock, bot_end, P.stringR), C.stringCol,
|
|
|
|
|
|
|
+ cylinder_between(p.model, nock, bot_end, P.stringR), C.stringCol,
|
|
|
nullptr, 1.0F);
|
|
nullptr, 1.0F);
|
|
|
- out.mesh(getUnitCylinder(), cylinderBetween(p.model, P.hand_l, nock, 0.0045F),
|
|
|
|
|
|
|
+ out.mesh(getUnitCylinder(), cylinder_between(p.model, P.hand_l, nock, 0.0045F),
|
|
|
C.stringCol * 0.9F, nullptr, 1.0F);
|
|
C.stringCol * 0.9F, nullptr, 1.0F);
|
|
|
|
|
|
|
|
QVector3D tail = nock - forward * 0.06F;
|
|
QVector3D tail = nock - forward * 0.06F;
|
|
|
QVector3D tip = tail + forward * 0.90F;
|
|
QVector3D tip = tail + forward * 0.90F;
|
|
|
- out.mesh(getUnitCylinder(), cylinderBetween(p.model, tail, tip, 0.035F),
|
|
|
|
|
|
|
+ out.mesh(getUnitCylinder(), cylinder_between(p.model, tail, tip, 0.035F),
|
|
|
C.wood, nullptr, 1.0F);
|
|
C.wood, nullptr, 1.0F);
|
|
|
QVector3D head_base = tip - forward * 0.10F;
|
|
QVector3D head_base = tip - forward * 0.10F;
|
|
|
- out.mesh(getUnitCone(), coneFromTo(p.model, head_base, tip, 0.05F),
|
|
|
|
|
|
|
+ out.mesh(getUnitCone(), cone_from_to(p.model, head_base, tip, 0.05F),
|
|
|
C.metalHead, nullptr, 1.0F);
|
|
C.metalHead, nullptr, 1.0F);
|
|
|
QVector3D f1b = tail - forward * 0.02F, f1a = f1b - forward * 0.06F;
|
|
QVector3D f1b = tail - forward * 0.02F, f1a = f1b - forward * 0.06F;
|
|
|
QVector3D f2b = tail + forward * 0.02F, f2a = f2b + forward * 0.06F;
|
|
QVector3D f2b = tail + forward * 0.02F, f2a = f2b + forward * 0.06F;
|
|
|
- out.mesh(getUnitCone(), coneFromTo(p.model, f1b, f1a, 0.04F), C.fletch,
|
|
|
|
|
|
|
+ out.mesh(getUnitCone(), cone_from_to(p.model, f1b, f1a, 0.04F), C.fletch,
|
|
|
nullptr, 1.0F);
|
|
nullptr, 1.0F);
|
|
|
- out.mesh(getUnitCone(), coneFromTo(p.model, f2a, f2b, 0.04F), C.fletch,
|
|
|
|
|
|
|
+ out.mesh(getUnitCone(), cone_from_to(p.model, f2a, f2b, 0.04F), C.fletch,
|
|
|
nullptr, 1.0F);
|
|
nullptr, 1.0F);
|
|
|
}
|
|
}
|
|
|
|
|
|