mirror of
https://gitgud.io/ll.mirrors/sizedapparel.git
synced 2024-08-15 00:43:40 +00:00
Mirror of 1.4.22 from Lovers Lab
This commit is contained in:
parent
5d0da3bc88
commit
b501ddfb0f
1119 changed files with 12505 additions and 2543 deletions
|
@ -137,7 +137,7 @@ namespace SizedApparel
|
|||
|
||||
public enum ColorType
|
||||
{
|
||||
Skin, Hair, Custom, None
|
||||
Skin, Hair, Nipple, Custom, None
|
||||
}
|
||||
|
||||
|
||||
|
@ -294,6 +294,15 @@ namespace SizedApparel
|
|||
public class SizedApparelBodyPart
|
||||
{
|
||||
static MethodInfo overrideMatMethod = AccessTools.Method(typeof(PawnRenderer), "OverrideMaterialIfNeeded");
|
||||
static Color defaultNippleColor = Color.white;//nipple texture is already colored with pink. so make it white as default to avoid double coloring pink //Strong Pink Color = new ColorInt(255, 121, 121).ToColor
|
||||
|
||||
//this is for RGB Channel Edit
|
||||
static string texturePath_White = "SizedApparel/Masks/White";
|
||||
static string texturePath_Black = "SizedApparel/Masks/Black";
|
||||
static string texturePath_Red = "SizedApparel/Masks/Red";
|
||||
static string texturePath_Green = "SizedApparel/Masks/Green";
|
||||
static string texturePath_Blue = "SizedApparel/Masks/Blue";
|
||||
|
||||
|
||||
public bool AutoOffsetForFurCoveredBody = true;
|
||||
|
||||
|
@ -420,7 +429,7 @@ namespace SizedApparel
|
|||
}
|
||||
}
|
||||
|
||||
public bool CheckCanPose(string targetPose, bool checkApparels, bool checkBodyParts, bool mustMatchSize, bool mustMatchBodytype)
|
||||
public bool CheckCanPose(string targetPose, bool checkApparels, bool checkBodyParts, bool mustMatchSize, bool mustMatchBodytype, bool mustMatchRace)
|
||||
{
|
||||
if (checkApparels)
|
||||
{
|
||||
|
@ -429,8 +438,8 @@ namespace SizedApparel
|
|||
}
|
||||
if (checkBodyParts)
|
||||
{
|
||||
Graphic graphic = GetBodyPartGraphics(false, mustMatchSize, mustMatchBodytype, targetPose);
|
||||
Graphic graphicH = GetBodyPartGraphics(true, mustMatchSize, mustMatchBodytype, targetPose);
|
||||
Graphic graphic = GetBodyPartGraphics(false, mustMatchSize, mustMatchBodytype, mustMatchRace);
|
||||
Graphic graphicH = GetBodyPartGraphics(true, mustMatchSize, mustMatchBodytype, mustMatchRace);
|
||||
if (graphic != null || graphicH != null)
|
||||
return true;
|
||||
return false;
|
||||
|
@ -496,13 +505,13 @@ namespace SizedApparel
|
|||
positionOffsetEast = east;
|
||||
positionOffsetWest = west;
|
||||
}
|
||||
public Graphic GetBodyPartGraphics(bool isHorny, bool mustMatchSize = false, bool mustMatchBodytype = false, string poseOverride = null)
|
||||
public Graphic GetBodyPartGraphics(bool isHorny, bool mustMatchSize = false, bool mustMatchBodytype = false, bool mustMatchRace = false, string poseOverride = null)
|
||||
{
|
||||
SizedApparelTexturePointDef var;
|
||||
return GetBodyPartGraphics(isHorny, out var, mustMatchBodytype, mustMatchSize, poseOverride);
|
||||
return GetBodyPartGraphics(isHorny, out var, mustMatchBodytype, mustMatchSize, mustMatchRace, poseOverride);
|
||||
}
|
||||
|
||||
public Graphic GetBodyPartGraphics(bool isHorny, out SizedApparelTexturePointDef outPoints, bool mustMatchSize = false, bool mustMatchBodyType = false ,string poseOverride = null, string variationOverride = null)
|
||||
public Graphic GetBodyPartGraphics(bool isHorny, out SizedApparelTexturePointDef outPoints, bool mustMatchSize = false, bool mustMatchBodyType = false , bool mustMatchRace = false ,string poseOverride = null, string variationOverride = null)
|
||||
{
|
||||
if (pawn == null)
|
||||
{
|
||||
|
@ -540,6 +549,14 @@ namespace SizedApparel
|
|||
return null;
|
||||
}
|
||||
}
|
||||
if (mustMatchRace)
|
||||
{
|
||||
if (result.raceName != pawn.def.defName)
|
||||
{
|
||||
outPoints = null;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (result.pathWithSizeIndex == null)
|
||||
{
|
||||
|
@ -625,7 +642,7 @@ namespace SizedApparel
|
|||
|
||||
|
||||
PawnRenderer pawnRenderer = pawn.Drawer.renderer;
|
||||
Shader shader = ShaderDatabase.CutoutComplex;
|
||||
Shader shader = shader = ShaderDatabase.CutoutSkinOverlay;
|
||||
Color drawColor1 = Color.white;
|
||||
Color drawColor2 = Color.white;
|
||||
|
||||
|
@ -648,7 +665,7 @@ namespace SizedApparel
|
|||
{
|
||||
shader = pawn.Drawer.renderer.graphics.furCoveredGraphic.Shader;
|
||||
if (!ShaderUtility.SupportsMaskTex(shader))
|
||||
shader = ShaderDatabase.CutoutSkinOverlay;
|
||||
shader = shader = ShaderDatabase.CutoutSkinOverlay;
|
||||
shader = pawnRenderer.graphics.furCoveredGraphic.Shader;
|
||||
drawColor1 = pawnRenderer.graphics.furCoveredGraphic.Color;
|
||||
drawColor2 = pawnRenderer.graphics.furCoveredGraphic.ColorTwo;
|
||||
|
@ -657,7 +674,7 @@ namespace SizedApparel
|
|||
{
|
||||
shader = pawn.Drawer.renderer.graphics.nakedGraphic.Shader;
|
||||
if (!ShaderUtility.SupportsMaskTex(shader))
|
||||
shader = ShaderDatabase.CutoutSkinOverlay;
|
||||
shader = shader = ShaderDatabase.CutoutSkinOverlay;
|
||||
drawColor1 = pawnRenderer.graphics.nakedGraphic.Color;
|
||||
drawColor2 = pawnRenderer.graphics.nakedGraphic.ColorTwo;
|
||||
}
|
||||
|
@ -668,10 +685,63 @@ namespace SizedApparel
|
|||
|
||||
shader = pawn.Drawer.renderer.graphics.rottingGraphic.Shader;
|
||||
if (!ShaderUtility.SupportsMaskTex(shader))
|
||||
shader = ShaderDatabase.CutoutSkinOverlay;
|
||||
shader = shader = ShaderDatabase.CutoutSkinOverlay;
|
||||
drawColor1 = pawnRenderer.graphics.rottingGraphic.Color;
|
||||
drawColor2 = pawnRenderer.graphics.nakedGraphic.ColorTwo;
|
||||
}
|
||||
}
|
||||
else if (colorType == ColorType.Nipple)
|
||||
{
|
||||
forceWriteZ = true;
|
||||
|
||||
//Get SkinColor first.
|
||||
if (bodyDrawType == RotDrawMode.Fresh)
|
||||
{
|
||||
if (HasFurSkin)
|
||||
{
|
||||
shader = pawn.Drawer.renderer.graphics.furCoveredGraphic.Shader;
|
||||
if (!ShaderUtility.SupportsMaskTex(shader))
|
||||
shader = ShaderDatabase.CutoutSkinOverlay;
|
||||
shader = pawnRenderer.graphics.furCoveredGraphic.Shader;
|
||||
drawColor1 = pawnRenderer.graphics.furCoveredGraphic.Color;
|
||||
drawColor2 = pawnRenderer.graphics.furCoveredGraphic.ColorTwo;
|
||||
}
|
||||
else
|
||||
{
|
||||
shader = pawn.Drawer.renderer.graphics.nakedGraphic.Shader;
|
||||
if (!ShaderUtility.SupportsMaskTex(shader))
|
||||
shader = shader = ShaderDatabase.CutoutSkinOverlay;
|
||||
drawColor1 = pawnRenderer.graphics.nakedGraphic.Color;
|
||||
drawColor2 = pawnRenderer.graphics.nakedGraphic.ColorTwo;
|
||||
}
|
||||
|
||||
}
|
||||
else if (bodyDrawType == RotDrawMode.Rotting)
|
||||
{
|
||||
|
||||
shader = pawn.Drawer.renderer.graphics.rottingGraphic.Shader;
|
||||
if (!ShaderUtility.SupportsMaskTex(shader))
|
||||
shader = shader = ShaderDatabase.CutoutSkinOverlay;
|
||||
drawColor1 = pawnRenderer.graphics.rottingGraphic.Color;
|
||||
drawColor2 = pawnRenderer.graphics.nakedGraphic.ColorTwo;
|
||||
}
|
||||
|
||||
if(apparelRecorderCompCache != null)
|
||||
{
|
||||
if(apparelRecorderCompCache.nippleColor != null)
|
||||
{
|
||||
drawColor1 = apparelRecorderCompCache.nippleColor.Value; //* drawColor1;
|
||||
drawColor2 = apparelRecorderCompCache.nippleColor.Value; //* drawColor2; //maybe can be issue
|
||||
}
|
||||
else
|
||||
{
|
||||
//nipple Color is null
|
||||
//Ust Default Color for Nipple with SkinColor
|
||||
drawColor1 = defaultNippleColor * drawColor1;
|
||||
drawColor2 = defaultNippleColor * drawColor2;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -696,7 +766,15 @@ namespace SizedApparel
|
|||
forceWriteZ = false;
|
||||
shader = ShaderDatabase.Cutout;
|
||||
}
|
||||
|
||||
if (isOverlay)
|
||||
{
|
||||
if (shader == ShaderDatabase.Cutout)
|
||||
shader = ShaderDatabase.Transparent;
|
||||
else if (shader == ShaderDatabase.CutoutSkin || shader == ShaderDatabase.CutoutSkinColorOverride)
|
||||
shader = ShaderDatabase.CutoutSkinOverlay;
|
||||
else
|
||||
shader = ShaderDatabase.Transparent;
|
||||
}
|
||||
|
||||
|
||||
Mesh scaledBodyMesh;
|
||||
|
@ -739,13 +817,13 @@ namespace SizedApparel
|
|||
{
|
||||
//TODO fixed angle for IK?
|
||||
|
||||
|
||||
float width = (bodyMesh.vertices[2].x - bodyMesh.vertices[0].x);
|
||||
if (centeredTexture)
|
||||
{
|
||||
bool westUsingEast = false;
|
||||
if (facing == Rot4.West && bone.west == null)
|
||||
westUsingEast = true;
|
||||
float width = (bodyMesh.vertices[2].x - bodyMesh.vertices[0].x);
|
||||
|
||||
drawRotation = boneTransform.InitialAngle + boneTransform.angleOffset;
|
||||
//not sure it work correct
|
||||
Vector3 v = (boneTransform.InitialPosition + boneTransform.positionOffset) * width;
|
||||
|
@ -765,20 +843,24 @@ namespace SizedApparel
|
|||
drawRotation += angle ;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
//NotCentered Texture not yet support Rotation System.
|
||||
//wip
|
||||
Vector3 v = Vector3.zero;
|
||||
|
||||
bool westUsingEast = false;
|
||||
if (facing == Rot4.West && bone.west == null)
|
||||
westUsingEast = true;
|
||||
float width = (bodyMesh.vertices[2].x - bodyMesh.vertices[0].x);
|
||||
drawRotation = boneTransform.InitialAngle + boneTransform.angleOffset;
|
||||
drawRotation = boneTransform.InitialAngle; // + boneTransform.angleOffset
|
||||
//not sure it work correct
|
||||
Vector3 v = (-boneTransform.InitialPosition); //initialpos as custom pivot
|
||||
var q = Quaternion.AngleAxis(westUsingEast ? -drawRotation : drawRotation, Vector3.up);
|
||||
var q2 = Quaternion.AngleAxis(westUsingEast ? -angle : angle, Vector3.up);
|
||||
v = q * v; // calculate final draw position with torso angle
|
||||
v = v + boneTransform.InitialPosition + boneTransform.positionOffset;
|
||||
v = q2 * v;
|
||||
//Vector3 v = (boneTransform.InitialPosition); //initialpos as custom pivot
|
||||
//var q = Quaternion.AngleAxis(westUsingEast ? -drawRotation : drawRotation, Vector3.up);
|
||||
//var q2 = Quaternion.AngleAxis(westUsingEast ? -angle : angle, Vector3.up);
|
||||
|
||||
//v = q * v; // calculate final draw position with torso angle
|
||||
//v = v + boneTransform.InitialPosition + boneTransform.positionOffset;
|
||||
//v = q2 * v; //NotCentered Texture not yet support Rotation System.
|
||||
|
||||
drawPosition = (v) * width;
|
||||
if (westUsingEast)
|
||||
{
|
||||
|
@ -877,19 +959,30 @@ namespace SizedApparel
|
|||
|
||||
Material mat;
|
||||
|
||||
if (!flags.FlagSet(PawnRenderFlags.Cache)&&!isOverlay&& forceWriteZ)
|
||||
//If ForceWriteDepth, draw Cutout mesh for write depth. this is for avoid problem of body addons drawing under other meshes. such as breasts front of body but behind tail.
|
||||
if (forceWriteZ || (!flags.FlagSet(PawnRenderFlags.Cache) && !isOverlay))// //(!flags.FlagSet(PawnRenderFlags.Cache) && !isOverlay)
|
||||
{
|
||||
graphic = graphic.GetColoredVersion(ShaderDatabase.Cutout, drawColor1, drawColor2); // ShaderDatabase.Cutout
|
||||
mat = flags.FlagSet(PawnRenderFlags.Cache) ? graphic.MatAt(targetRot) : (Material)overrideMatMethod.Invoke(pawnRenderer, new object[] { graphic.MatAt(facing), pawn, flags.FlagSet(PawnRenderFlags.Portrait) });
|
||||
GenDraw.DrawMeshNowOrLater(scaledBodyMesh, drawPosition, quaternion, mat, flags.FlagSet(PawnRenderFlags.DrawNow)); // draw for writeZ data to solve shadow issue
|
||||
Graphic Zgraphic = graphic.GetColoredVersion(ShaderDatabase.CutoutComplex, drawColor1, drawColor2); // ShaderDatabase.Cutout
|
||||
Vector3 drawPositionZ = drawPosition;
|
||||
drawPositionZ.y = 0; //Send Back of body, but it can still write depth.
|
||||
|
||||
mat = flags.FlagSet(PawnRenderFlags.Cache) ? Zgraphic.MatAt(targetRot) : (Material)overrideMatMethod.Invoke(pawnRenderer, new object[] { Zgraphic.MatAt(facing), pawn, flags.FlagSet(PawnRenderFlags.Portrait) });
|
||||
GenDraw.DrawMeshNowOrLater(scaledBodyMesh, drawPositionZ, quaternion, mat, flags.FlagSet(PawnRenderFlags.DrawNow)); // draw for writeZ data to solve shadow issue
|
||||
}
|
||||
|
||||
|
||||
//shader must be mask
|
||||
graphic = graphic.GetColoredVersion(shader, drawColor1, drawColor2);
|
||||
drawPosition.y += 0.00001f;
|
||||
|
||||
if (graphic.maskPath == null)
|
||||
{
|
||||
//Test
|
||||
//graphic.maskPath = texturePath_Red;
|
||||
}
|
||||
|
||||
//drawPosition.y += 0.00001f;
|
||||
mat = flags.FlagSet(PawnRenderFlags.Cache) ? graphic.MatAt(targetRot) : (Material)overrideMatMethod.Invoke(pawnRenderer, new object[] { graphic.MatAt(facing), pawn, flags.FlagSet(PawnRenderFlags.Portrait) });
|
||||
GenDraw.DrawMeshNowOrLater(scaledBodyMesh, drawPosition, quaternion, mat, flags.FlagSet(PawnRenderFlags.DrawNow));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue