public static void SetBody(ref BodyProperties bodyProperties, int build, int weight)
        {
            FaceGenerationParams faceGenerationParams = FaceGenerationParams.Create();

            MBBodyProperties.GetParamsFromKey(ref faceGenerationParams, bodyProperties, false);
            MBBodyProperties.ProduceNumericKeyWithParams(faceGenerationParams, false, ref bodyProperties);
        }
Exemplo n.º 2
0
 void IFaceGen.GenerateParentBody(
     BodyProperties childBodyProperties,
     ref BodyProperties motherBodyProperties,
     ref BodyProperties fatherBodyProperties)
 {
     MBBodyProperties.GenerateParentKey(childBodyProperties, ref motherBodyProperties, ref fatherBodyProperties);
 }
        public void SetRandomParamsExceptKeys(int gender, int minAge, out float scale)
        {
            int hairNum         = 0;
            int beardNum        = 0;
            int faceTextureNum  = 0;
            int mouthTextureNum = 0;
            int eyebrowNum      = 0;
            int soundNum        = 0;
            int faceTattooNum   = 0;

            scale = 0.0f;
            MBBodyProperties.GetParamsMax(gender, minAge, ref hairNum, ref beardNum, ref faceTextureNum, ref mouthTextureNum, ref faceTattooNum, ref soundNum, ref eyebrowNum, ref scale);
            this._currentHair               = MBRandom.RandomInt(hairNum);
            this._curBeard                  = MBRandom.RandomInt(beardNum);
            this._curFaceTexture            = MBRandom.RandomInt(faceTextureNum);
            this._curMouthTexture           = MBRandom.RandomInt(mouthTextureNum);
            this._curFaceTattoo             = MBRandom.RandomInt(faceTattooNum);
            this._currentVoice              = MBRandom.RandomInt(soundNum);
            this._voicePitch                = MBRandom.RandomFloat;
            this._curEyebrow                = MBRandom.RandomInt(eyebrowNum);
            this._curSkinColorOffset        = MBRandom.RandomFloat;
            this._curHairColorOffset        = MBRandom.RandomFloat;
            this._curEyeColorOffset         = MBRandom.RandomFloat;
            this._curFaceTattooColorOffset1 = MBRandom.RandomFloat;
            this._heightMultiplier          = MBRandom.RandomFloat;
        }
Exemplo n.º 4
0
 public void GetParamsFromBody(
     ref FaceGenerationParams faceGenerationParams,
     BodyProperties bodyProperties,
     bool earsAreHidden)
 {
     MBBodyProperties.GetParamsFromKey(ref faceGenerationParams, bodyProperties, earsAreHidden);
 }
Exemplo n.º 5
0
 void IFaceGen.SetPigmentation(
     ref BodyProperties bodyProperties,
     int skinColor,
     int hairColor,
     int eyeColor)
 {
     MBBodyProperties.SetPigmentation(ref bodyProperties, skinColor, hairColor, eyeColor);
 }
Exemplo n.º 6
0
 void IFaceGen.SetHair(
     ref BodyProperties bodyProperties,
     int hair,
     int beard,
     int tattoo)
 {
     MBBodyProperties.SetHair(ref bodyProperties, hair, beard, tattoo);
 }
        public static void SetPigmentation(
            ref BodyProperties bodyProperties,
            int skinColor,
            int hairColor,
            int eyeColor)
        {
            FaceGenerationParams faceGenerationParams = FaceGenerationParams.Create();

            MBBodyProperties.GetParamsFromKey(ref faceGenerationParams, bodyProperties, false);
            MBBodyProperties.ProduceNumericKeyWithParams(faceGenerationParams, false, ref bodyProperties);
        }
        public FaceGenerationParams InitBodyGenerator()
        {
            this.CurrentBodyProperties = this.Character.GetBodyProperties(this.Character.Equipment);
            FaceGenerationParams faceGenerationParams = FaceGenerationParams.Create();

            faceGenerationParams._currentGender = this.Character.IsFemale ? 1 : 0;
            faceGenerationParams._curAge        = this.Character.Age;
            MBBodyProperties.GetParamsFromKey(ref faceGenerationParams, this.CurrentBodyProperties, this.Character.Equipment.EarsAreHidden);
            faceGenerationParams.SetGenderAndAdjustParams(faceGenerationParams._currentGender, (int)faceGenerationParams._curAge);
            return(faceGenerationParams);
        }
Exemplo n.º 9
0
 public BodyProperties GetRandomBodyProperties(
     bool isFemale,
     BodyProperties bodyPropertiesMin,
     BodyProperties bodyPropertiesMax,
     int hairCoverType,
     int seed,
     string hairTags,
     string beardTags,
     string tatooTags)
 {
     return(MBBodyProperties.GetRandomBodyProperties(isFemale, bodyPropertiesMin, bodyPropertiesMax, hairCoverType, seed, hairTags, beardTags, tatooTags));
 }
        public static List <uint> GetHairColorGradientPoints(int curGender, int age)
        {
            int         hairColorCount = MBBodyProperties.GetHairColorCount(curGender, age);
            List <uint> uintList       = new List <uint>();

            Vec3[] colors = new Vec3[hairColorCount];
            MBAPI.IMBFaceGen.GetHairColorGradientPoints(curGender, (float)age, colors);
            foreach (Vec3 vec3 in colors)
            {
                uintList.Add(MBMath.ColorFromRGBA(vec3.x, vec3.y, vec3.z, 1f));
            }
            return(uintList);
        }
        public static BodyProperties GetBodyPropertiesWithAge(
            ref BodyProperties bodyProperties,
            float age)
        {
            FaceGenerationParams faceGenerationParams = new FaceGenerationParams();

            MBBodyProperties.GetParamsFromKey(ref faceGenerationParams, bodyProperties, false);
            faceGenerationParams._curAge = age;
            BodyProperties bodyProperties1 = new BodyProperties();

            MBBodyProperties.ProduceNumericKeyWithParams(faceGenerationParams, false, ref bodyProperties1);
            return(bodyProperties1);
        }
        public static void SetHair(ref BodyProperties bodyProperties, int hair, int beard, int tattoo)
        {
            FaceGenerationParams faceGenerationParams = FaceGenerationParams.Create();

            MBBodyProperties.GetParamsFromKey(ref faceGenerationParams, bodyProperties, false);
            if (hair > -1)
            {
                faceGenerationParams._currentHair = hair;
            }
            if (beard > -1)
            {
                faceGenerationParams._curBeard = beard;
            }
            if (tattoo > -1)
            {
                faceGenerationParams._curFaceTattoo = tattoo;
            }
            MBBodyProperties.ProduceNumericKeyWithParams(faceGenerationParams, false, ref bodyProperties);
        }
        public void SetGenderAndAdjustParams(int gender, int curAge)
        {
            this._currentGender = gender;
            int   hairNum         = 0;
            int   beardNum        = 0;
            int   faceTextureNum  = 0;
            int   mouthTextureNum = 0;
            int   eyebrowNum      = 0;
            int   soundNum        = 0;
            int   faceTattooNum   = 0;
            float scale           = 0.0f;

            MBBodyProperties.GetParamsMax(gender, curAge, ref hairNum, ref beardNum, ref faceTextureNum, ref mouthTextureNum, ref faceTattooNum, ref soundNum, ref eyebrowNum, ref scale);
            this._currentHair     = MBMath.ClampInt(this._currentHair, 0, hairNum - 1);
            this._curBeard        = MBMath.ClampInt(this._curBeard, 0, beardNum - 1);
            this._curFaceTexture  = MBMath.ClampInt(this._curFaceTexture, 0, faceTextureNum - 1);
            this._curMouthTexture = MBMath.ClampInt(this._curMouthTexture, 0, mouthTextureNum - 1);
            this._curFaceTattoo   = MBMath.ClampInt(this._curFaceTattoo, 0, faceTattooNum - 1);
            this._currentVoice    = MBMath.ClampInt(this._currentVoice, 0, soundNum - 1);
            this._voicePitch      = MBMath.ClampFloat(this._voicePitch, 0.0f, 1f);
            this._curEyebrow      = MBMath.ClampInt(this._curEyebrow, 0, eyebrowNum - 1);
        }
Exemplo n.º 14
0
 public BodyProperties GetBodyPropertiesWithAge(
     ref BodyProperties bodyProperties,
     float age)
 {
     return(MBBodyProperties.GetBodyPropertiesWithAge(ref bodyProperties, age));
 }
        public static void GenerateParentKey(
            BodyProperties childBodyProperties,
            ref BodyProperties motherBodyProperties,
            ref BodyProperties fatherBodyProperties)
        {
            FaceGenerationParams faceGenerationParams1 = FaceGenerationParams.Create();
            FaceGenerationParams faceGenerationParams2 = FaceGenerationParams.Create();
            FaceGenerationParams faceGenerationParams3 = FaceGenerationParams.Create();

            MBBodyProperties.GenerationType[] generationTypeArray = new MBBodyProperties.GenerationType[4];
            for (int index = 0; index < generationTypeArray.Length; ++index)
            {
                generationTypeArray[index] = (MBBodyProperties.GenerationType)MBRandom.RandomInt(2);
            }
            MBBodyProperties.GetParamsFromKey(ref faceGenerationParams1, childBodyProperties, false);
            int genInstancesLength = MBBodyProperties.GetFaceGenInstancesLength(faceGenerationParams1._currentGender, (int)faceGenerationParams1._curAge);

            for (int keyNo = 0; keyNo < genInstancesLength; ++keyNo)
            {
                DeformKeyData deformKeyData = MBBodyProperties.GetDeformKeyData(keyNo, faceGenerationParams1._currentGender, (int)faceGenerationParams1._curAge);
                if (deformKeyData.GroupId >= 0 && deformKeyData.GroupId != 0 && (deformKeyData.GroupId != 5 && deformKeyData.GroupId != 6))
                {
                    float num = MBRandom.RandomFloat * Math.Min(faceGenerationParams1.KeyWeights[keyNo], 1f - faceGenerationParams1.KeyWeights[keyNo]);
                    if (generationTypeArray[deformKeyData.GroupId - 1] == MBBodyProperties.GenerationType.FromMother)
                    {
                        faceGenerationParams3.KeyWeights[keyNo] = faceGenerationParams1.KeyWeights[keyNo];
                        faceGenerationParams2.KeyWeights[keyNo] = faceGenerationParams1.KeyWeights[keyNo] + num;
                    }
                    else if (generationTypeArray[deformKeyData.GroupId - 1] == MBBodyProperties.GenerationType.FromFather)
                    {
                        faceGenerationParams2.KeyWeights[keyNo] = faceGenerationParams1.KeyWeights[keyNo];
                        faceGenerationParams3.KeyWeights[keyNo] = faceGenerationParams1.KeyWeights[keyNo] + num;
                    }
                    else
                    {
                        faceGenerationParams3.KeyWeights[keyNo] = faceGenerationParams1.KeyWeights[keyNo] + num;
                        faceGenerationParams2.KeyWeights[keyNo] = faceGenerationParams1.KeyWeights[keyNo] - num;
                    }
                }
            }
            faceGenerationParams2._curAge = faceGenerationParams1._curAge + (float)MBRandom.RandomInt(18, 25);
            faceGenerationParams2.SetRandomParamsExceptKeys(0, (int)faceGenerationParams2._curAge, out float _);
            faceGenerationParams2._curFaceTattoo = 0;
            faceGenerationParams3._curAge        = faceGenerationParams1._curAge + (float)MBRandom.RandomInt(18, 22);
            faceGenerationParams3.SetRandomParamsExceptKeys(1, (int)faceGenerationParams3._curAge, out float _);
            faceGenerationParams3._curFaceTattoo    = 0;
            faceGenerationParams3._heightMultiplier = faceGenerationParams2._heightMultiplier * MBRandom.RandomFloatRanged(0.7f, 0.9f);
            if (faceGenerationParams3._currentHair == 0)
            {
                faceGenerationParams3._currentHair = 1;
            }
            float num1 = MBRandom.RandomFloat * Math.Min(faceGenerationParams1._curSkinColorOffset, 1f - faceGenerationParams1._curSkinColorOffset);

            if (MBRandom.RandomInt(2) == 1)
            {
                faceGenerationParams2._curSkinColorOffset = faceGenerationParams1._curSkinColorOffset + num1;
                faceGenerationParams3._curSkinColorOffset = faceGenerationParams1._curSkinColorOffset - num1;
            }
            else
            {
                faceGenerationParams2._curSkinColorOffset = faceGenerationParams1._curSkinColorOffset - num1;
                faceGenerationParams3._curSkinColorOffset = faceGenerationParams1._curSkinColorOffset + num1;
            }
            MBBodyProperties.ProduceNumericKeyWithParams(faceGenerationParams3, false, ref motherBodyProperties);
            MBBodyProperties.ProduceNumericKeyWithParams(faceGenerationParams2, false, ref fatherBodyProperties);
        }
Exemplo n.º 16
0
 void IFaceGen.SetBody(ref BodyProperties bodyProperties, int build, int weight) => MBBodyProperties.SetBody(ref bodyProperties, build, weight);
Exemplo n.º 17
0
 public BodyMeshMaturityType GetMaturityTypeWithAge(float age) => MBBodyProperties.GetMaturityType(age);
 public void RefreshFace(FaceGenerationParams faceGenerationParams)
 {
     MBBodyProperties.ProduceNumericKeyWithParams(faceGenerationParams, this.Character.Equipment.EarsAreHidden, ref this.CurrentBodyProperties);
     this.IsFemale = faceGenerationParams._currentGender == 1;
 }