diff --git a/src/art/webgl/art.js b/src/art/webgl/art.js index dbba73cdf5c22445c8f32edde4cccff38714a54c..ca36b588a5d954dec1989129e29740ff8cc8b93f 100644 --- a/src/art/webgl/art.js +++ b/src/art/webgl/art.js @@ -512,6 +512,11 @@ App.Art.applyMorphs = function(slave, scene) { return (targetMax-targetMin)/(sourceMax-sourceMin)*(value-sourceMin)+targetMin; } + function random(seed) { + let x = Math.sin(seed++) * 10000; + return x - Math.floor(x); + } + if(hasBothArms(slave) && hasBothLegs(slave)) { if (slave.devotion > 50) { morphs.push(["posesHigh", 1]); @@ -526,6 +531,12 @@ App.Art.applyMorphs = function(slave, scene) { } } + // used for interpolating mixed race based on slave ID + let races = ["raceWhite" , "raceAsian", "raceLatina", "raceBlack", "racePacific", "raceEuropean" ,"raceAmerindian", "raceSemitic", "raceEastern", "raceAryan", "raceLatina", "raceMalay"]; + let rand = random(slave.ID); + let index1 = Math.floor(random(slave.ID+1) * races.length); + let index2 = Math.floor(random(slave.ID-1) * (races.length-1)); + switch (slave.race) { case "white": morphs.push(["raceWhite", 1]); break; @@ -547,15 +558,12 @@ App.Art.applyMorphs = function(slave, scene) { morphs.push(["raceEastern", 1]); break; case "indo-aryan": morphs.push(["raceAryan", 1]); break; + case "malay": + morphs.push(["raceMalay", 1]); break; case "mixed race": - /* - let races = ["raceWhite" , "raceAsian", "raceLatina", "raceBlack", "racePacific", "raceEuropean" ,"raceAmerindian", "raceSemitic", "raceEastern", "raceAryan", "raceLatina"]; - let rand = Math.random(); - let index1 = Math.floor(Math.random() * races.length); - let index2 = Math.floor(Math.random() * races.length-1); morphs.push([races[index1], rand]); races.splice(index1, index1); - morphs.push([races[index2], 1-rand]);*/ + morphs.push([races[index2], 1-rand]); break; }