示例#1
0
        private void RenderPawnInternal(Vector3 rootLoc, float angle, bool renderBody, Rot4 bodyFacing, Rot4 headFacing, RotDrawMode bodyDrawType, bool portrait, bool headStump, bool invisible)
        {
            if (!graphics.AllResolved)
            {
                graphics.ResolveAllGraphics();
            }
            Quaternion quaternion = Quaternion.AngleAxis(angle, Vector3.up);
            Mesh       mesh       = null;

            if (renderBody)
            {
                Vector3 loc = rootLoc;
                loc.y += 9f / 980f;
                if (bodyDrawType == RotDrawMode.Dessicated && !pawn.RaceProps.Humanlike && graphics.dessicatedGraphic != null && !portrait)
                {
                    graphics.dessicatedGraphic.Draw(loc, bodyFacing, pawn, angle);
                }
                else
                {
                    mesh = ((!pawn.RaceProps.Humanlike) ? graphics.nakedGraphic.MeshAt(bodyFacing) : MeshPool.humanlikeBodySet.MeshAt(bodyFacing));
                    List <Material> list = graphics.MatsBodyBaseAt(bodyFacing, bodyDrawType);
                    for (int i = 0; i < list.Count; i++)
                    {
                        Material mat = OverrideMaterialIfNeeded_NewTemp(list[i], pawn, portrait);
                        GenDraw.DrawMeshNowOrLater(mesh, loc, quaternion, mat, portrait);
                        loc.y += 3f / 980f;
                    }
                    if (bodyDrawType == RotDrawMode.Fresh)
                    {
                        Vector3 drawLoc = rootLoc;
                        drawLoc.y += 9f / 490f;
                        woundOverlays.RenderOverBody(drawLoc, mesh, quaternion, portrait);
                    }
                }
            }
            Vector3 vector = rootLoc;
            Vector3 a      = rootLoc;

            if (bodyFacing != Rot4.North)
            {
                a.y      += 6f / 245f;
                vector.y += 3f / 140f;
            }
            else
            {
                a.y      += 3f / 140f;
                vector.y += 6f / 245f;
            }
            Vector3 vector2 = rootLoc;

            vector2.y += ((bodyFacing == Rot4.South) ? (3f / 490f) : (27f / 980f));
            List <ApparelGraphicRecord> apparelGraphics = graphics.apparelGraphics;

            if (graphics.headGraphic != null)
            {
                Vector3  b        = quaternion * BaseHeadOffsetAt(headFacing);
                Material material = graphics.HeadMatAt_NewTemp(headFacing, bodyDrawType, headStump, portrait);
                if (material != null)
                {
                    GenDraw.DrawMeshNowOrLater(MeshPool.humanlikeHeadSet.MeshAt(headFacing), a + b, quaternion, material, portrait);
                }
                Vector3 loc2 = rootLoc + b;
                loc2.y += 3f / 98f;
                bool flag = false;
                if (!portrait || !Prefs.HatsOnlyOnMap)
                {
                    Mesh mesh2 = graphics.HairMeshSet.MeshAt(headFacing);
                    for (int j = 0; j < apparelGraphics.Count; j++)
                    {
                        if (apparelGraphics[j].sourceApparel.def.apparel.LastLayer == ApparelLayerDefOf.Overhead)
                        {
                            if (!apparelGraphics[j].sourceApparel.def.apparel.hatRenderedFrontOfFace)
                            {
                                flag = true;
                                Material original = apparelGraphics[j].graphic.MatAt(bodyFacing);
                                original = OverrideMaterialIfNeeded_NewTemp(original, pawn, portrait);
                                GenDraw.DrawMeshNowOrLater(mesh2, loc2, quaternion, original, portrait);
                            }
                            else
                            {
                                Material original2 = apparelGraphics[j].graphic.MatAt(bodyFacing);
                                original2 = OverrideMaterialIfNeeded_NewTemp(original2, pawn, portrait);
                                Vector3 loc3 = rootLoc + b;
                                loc3.y += ((bodyFacing == Rot4.North) ? (3f / 980f) : (33f / 980f));
                                GenDraw.DrawMeshNowOrLater(mesh2, loc3, quaternion, original2, portrait);
                            }
                        }
                    }
                }
                if (!flag && bodyDrawType != RotDrawMode.Dessicated && !headStump)
                {
                    GenDraw.DrawMeshNowOrLater(graphics.HairMeshSet.MeshAt(headFacing), mat: graphics.HairMatAt_NewTemp(headFacing, portrait), loc: loc2, quat: quaternion, drawNow: portrait);
                }
            }
            if (renderBody)
            {
                for (int k = 0; k < apparelGraphics.Count; k++)
                {
                    ApparelGraphicRecord apparelGraphicRecord = apparelGraphics[k];
                    if (apparelGraphicRecord.sourceApparel.def.apparel.LastLayer == ApparelLayerDefOf.Shell && !apparelGraphicRecord.sourceApparel.def.apparel.shellRenderedBehindHead)
                    {
                        Material original3 = apparelGraphicRecord.graphic.MatAt(bodyFacing);
                        original3 = OverrideMaterialIfNeeded_NewTemp(original3, pawn, portrait);
                        GenDraw.DrawMeshNowOrLater(mesh, vector, quaternion, original3, portrait);
                    }
                    if (RenderAsPack(apparelGraphicRecord.sourceApparel))
                    {
                        Material original4 = apparelGraphicRecord.graphic.MatAt(bodyFacing);
                        original4 = OverrideMaterialIfNeeded_NewTemp(original4, pawn, portrait);
                        if (apparelGraphicRecord.sourceApparel.def.apparel.wornGraphicData != null)
                        {
                            Vector2   vector3 = apparelGraphicRecord.sourceApparel.def.apparel.wornGraphicData.BeltOffsetAt(bodyFacing, pawn.story.bodyType);
                            Vector2   vector4 = apparelGraphicRecord.sourceApparel.def.apparel.wornGraphicData.BeltScaleAt(pawn.story.bodyType);
                            Matrix4x4 matrix  = Matrix4x4.Translate(vector2) * Matrix4x4.Rotate(quaternion) * Matrix4x4.Translate(new Vector3(vector3.x, 0f, vector3.y)) * Matrix4x4.Scale(new Vector3(vector4.x, 1f, vector4.y));
                            GenDraw.DrawMeshNowOrLater_NewTemp(mesh, matrix, original4, portrait);
                        }
                        else
                        {
                            GenDraw.DrawMeshNowOrLater(mesh, vector, quaternion, original4, portrait);
                        }
                    }
                }
            }
            if (!portrait && pawn.RaceProps.Animal && pawn.inventory != null && pawn.inventory.innerContainer.Count > 0 && graphics.packGraphic != null)
            {
                Graphics.DrawMesh(mesh, vector, quaternion, graphics.packGraphic.MatAt(bodyFacing), 0);
            }
            if (portrait)
            {
                return;
            }
            DrawEquipment(rootLoc);
            if (pawn.apparel != null)
            {
                List <Apparel> wornApparel = pawn.apparel.WornApparel;
                for (int l = 0; l < wornApparel.Count; l++)
                {
                    wornApparel[l].DrawWornExtras();
                }
            }
            Vector3 bodyLoc = rootLoc;

            bodyLoc.y += 39f / 980f;
            statusOverlays.RenderStatusOverlays(bodyLoc, quaternion, MeshPool.humanlikeHeadSet.MeshAt(headFacing));
        }
示例#2
0
        private void RenderPawnInternal(Vector3 rootLoc, float angle, bool renderBody, Rot4 bodyFacing, Rot4 headFacing, RotDrawMode bodyDrawType, bool portrait, bool headStump)
        {
            if (!graphics.AllResolved)
            {
                graphics.ResolveAllGraphics();
            }
            Quaternion quaternion = Quaternion.AngleAxis(angle, Vector3.up);
            Mesh       mesh       = null;

            if (renderBody)
            {
                Vector3 loc = rootLoc;
                loc.y += 0.0078125f;
                if (bodyDrawType == RotDrawMode.Dessicated && !pawn.RaceProps.Humanlike && graphics.dessicatedGraphic != null && !portrait)
                {
                    graphics.dessicatedGraphic.Draw(loc, bodyFacing, pawn, angle);
                }
                else
                {
                    mesh = ((!pawn.RaceProps.Humanlike) ? graphics.nakedGraphic.MeshAt(bodyFacing) : MeshPool.humanlikeBodySet.MeshAt(bodyFacing));
                    List <Material> list = graphics.MatsBodyBaseAt(bodyFacing, bodyDrawType);
                    for (int i = 0; i < list.Count; i++)
                    {
                        Material damagedMat = graphics.flasher.GetDamagedMat(list[i]);
                        GenDraw.DrawMeshNowOrLater(mesh, loc, quaternion, damagedMat, portrait);
                        loc.y += 0.00390625f;
                    }
                    if (bodyDrawType == RotDrawMode.Fresh)
                    {
                        Vector3 drawLoc = rootLoc;
                        drawLoc.y += 0.01953125f;
                        woundOverlays.RenderOverBody(drawLoc, mesh, quaternion, portrait);
                    }
                }
            }
            Vector3 vector = rootLoc;
            Vector3 a      = rootLoc;

            if (bodyFacing != Rot4.North)
            {
                a.y      += 0.02734375f;
                vector.y += 0.0234375f;
            }
            else
            {
                a.y      += 0.0234375f;
                vector.y += 0.02734375f;
            }
            if (graphics.headGraphic != null)
            {
                Vector3  b        = quaternion * BaseHeadOffsetAt(headFacing);
                Material material = graphics.HeadMatAt(headFacing, bodyDrawType, headStump);
                if (material != null)
                {
                    Mesh mesh2 = MeshPool.humanlikeHeadSet.MeshAt(headFacing);
                    GenDraw.DrawMeshNowOrLater(mesh2, a + b, quaternion, material, portrait);
                }
                Vector3 loc2 = rootLoc + b;
                loc2.y += 0.03125f;
                bool flag = false;
                if (!portrait || !Prefs.HatsOnlyOnMap)
                {
                    Mesh mesh3 = graphics.HairMeshSet.MeshAt(headFacing);
                    List <ApparelGraphicRecord> apparelGraphics = graphics.apparelGraphics;
                    for (int j = 0; j < apparelGraphics.Count; j++)
                    {
                        ApparelGraphicRecord apparelGraphicRecord = apparelGraphics[j];
                        if (apparelGraphicRecord.sourceApparel.def.apparel.LastLayer == ApparelLayerDefOf.Overhead)
                        {
                            ApparelGraphicRecord apparelGraphicRecord2 = apparelGraphics[j];
                            if (!apparelGraphicRecord2.sourceApparel.def.apparel.hatRenderedFrontOfFace)
                            {
                                flag = true;
                                ApparelGraphicRecord apparelGraphicRecord3 = apparelGraphics[j];
                                Material             baseMat = apparelGraphicRecord3.graphic.MatAt(bodyFacing);
                                baseMat = graphics.flasher.GetDamagedMat(baseMat);
                                GenDraw.DrawMeshNowOrLater(mesh3, loc2, quaternion, baseMat, portrait);
                            }
                            else
                            {
                                ApparelGraphicRecord apparelGraphicRecord4 = apparelGraphics[j];
                                Material             baseMat2 = apparelGraphicRecord4.graphic.MatAt(bodyFacing);
                                baseMat2 = graphics.flasher.GetDamagedMat(baseMat2);
                                Vector3 loc3 = rootLoc + b;
                                loc3.y += ((!(bodyFacing == Rot4.North)) ? 0.03515625f : 0.00390625f);
                                GenDraw.DrawMeshNowOrLater(mesh3, loc3, quaternion, baseMat2, portrait);
                            }
                        }
                    }
                }
                if (!flag && bodyDrawType != RotDrawMode.Dessicated && !headStump)
                {
                    Mesh     mesh4 = graphics.HairMeshSet.MeshAt(headFacing);
                    Material mat   = graphics.HairMatAt(headFacing);
                    GenDraw.DrawMeshNowOrLater(mesh4, loc2, quaternion, mat, portrait);
                }
            }
            if (renderBody)
            {
                for (int k = 0; k < graphics.apparelGraphics.Count; k++)
                {
                    ApparelGraphicRecord apparelGraphicRecord5 = graphics.apparelGraphics[k];
                    if (apparelGraphicRecord5.sourceApparel.def.apparel.LastLayer == ApparelLayerDefOf.Shell)
                    {
                        Material baseMat3 = apparelGraphicRecord5.graphic.MatAt(bodyFacing);
                        baseMat3 = graphics.flasher.GetDamagedMat(baseMat3);
                        GenDraw.DrawMeshNowOrLater(mesh, vector, quaternion, baseMat3, portrait);
                    }
                }
            }
            if (!portrait && pawn.RaceProps.Animal && pawn.inventory != null && pawn.inventory.innerContainer.Count > 0 && graphics.packGraphic != null)
            {
                Graphics.DrawMesh(mesh, vector, quaternion, graphics.packGraphic.MatAt(bodyFacing), 0);
            }
            if (!portrait)
            {
                DrawEquipment(rootLoc);
                if (pawn.apparel != null)
                {
                    List <Apparel> wornApparel = pawn.apparel.WornApparel;
                    for (int l = 0; l < wornApparel.Count; l++)
                    {
                        wornApparel[l].DrawWornExtras();
                    }
                }
                Vector3 bodyLoc = rootLoc;
                bodyLoc.y += 0.04296875f;
                statusOverlays.RenderStatusOverlays(bodyLoc, quaternion, MeshPool.humanlikeHeadSet.MeshAt(headFacing));
            }
        }
示例#3
0
        private void RenderPawnInternal(Vector3 rootLoc, float angle, bool renderBody, Rot4 bodyFacing, Rot4 headFacing, RotDrawMode bodyDrawType, bool portrait, bool headStump, bool invisible)
        {
            if (!graphics.AllResolved)
            {
                graphics.ResolveAllGraphics();
            }
            Quaternion quaternion = Quaternion.AngleAxis(angle, Vector3.up);
            Mesh       mesh       = null;

            if (renderBody)
            {
                Vector3 loc = rootLoc;
                loc.y += 0.007575758f;
                if (bodyDrawType == RotDrawMode.Dessicated && !pawn.RaceProps.Humanlike && graphics.dessicatedGraphic != null && !portrait)
                {
                    graphics.dessicatedGraphic.Draw(loc, bodyFacing, pawn, angle);
                }
                else
                {
                    mesh = ((!pawn.RaceProps.Humanlike) ? graphics.nakedGraphic.MeshAt(bodyFacing) : MeshPool.humanlikeBodySet.MeshAt(bodyFacing));
                    List <Material> list = graphics.MatsBodyBaseAt(bodyFacing, bodyDrawType);
                    for (int i = 0; i < list.Count; i++)
                    {
                        Material mat = OverrideMaterialIfNeeded(list[i], pawn);
                        GenDraw.DrawMeshNowOrLater(mesh, loc, quaternion, mat, portrait);
                        loc.y += 0.003787879f;
                    }
                    if (bodyDrawType == RotDrawMode.Fresh)
                    {
                        Vector3 drawLoc = rootLoc;
                        drawLoc.y += 5f / 264f;
                        woundOverlays.RenderOverBody(drawLoc, mesh, quaternion, portrait);
                    }
                }
            }
            Vector3 vector = rootLoc;
            Vector3 a      = rootLoc;

            if (bodyFacing != Rot4.North)
            {
                a.y      += 7f / 264f;
                vector.y += 0.0227272734f;
            }
            else
            {
                a.y      += 0.0227272734f;
                vector.y += 7f / 264f;
            }
            if (graphics.headGraphic != null)
            {
                Vector3  b        = quaternion * BaseHeadOffsetAt(headFacing);
                Material material = graphics.HeadMatAt(headFacing, bodyDrawType, headStump);
                if (material != null)
                {
                    GenDraw.DrawMeshNowOrLater(MeshPool.humanlikeHeadSet.MeshAt(headFacing), a + b, quaternion, material, portrait);
                }
                Vector3 loc2 = rootLoc + b;
                loc2.y += 0.0303030312f;
                bool flag = false;
                if (!portrait || !Prefs.HatsOnlyOnMap)
                {
                    Mesh mesh2 = graphics.HairMeshSet.MeshAt(headFacing);
                    List <ApparelGraphicRecord> apparelGraphics = graphics.apparelGraphics;
                    for (int j = 0; j < apparelGraphics.Count; j++)
                    {
                        if (apparelGraphics[j].sourceApparel.def.apparel.LastLayer == ApparelLayerDefOf.Overhead)
                        {
                            if (!apparelGraphics[j].sourceApparel.def.apparel.hatRenderedFrontOfFace)
                            {
                                flag = true;
                                Material original = apparelGraphics[j].graphic.MatAt(bodyFacing);
                                original = OverrideMaterialIfNeeded(original, pawn);
                                GenDraw.DrawMeshNowOrLater(mesh2, loc2, quaternion, original, portrait);
                            }
                            else
                            {
                                Material original2 = apparelGraphics[j].graphic.MatAt(bodyFacing);
                                original2 = OverrideMaterialIfNeeded(original2, pawn);
                                Vector3 loc3 = rootLoc + b;
                                loc3.y += ((bodyFacing == Rot4.North) ? 0.003787879f : (3f / 88f));
                                GenDraw.DrawMeshNowOrLater(mesh2, loc3, quaternion, original2, portrait);
                            }
                        }
                    }
                }
                if (!flag && bodyDrawType != RotDrawMode.Dessicated && !headStump)
                {
                    GenDraw.DrawMeshNowOrLater(graphics.HairMeshSet.MeshAt(headFacing), mat: graphics.HairMatAt(headFacing), loc: loc2, quat: quaternion, drawNow: portrait);
                }
            }
            if (renderBody)
            {
                for (int k = 0; k < graphics.apparelGraphics.Count; k++)
                {
                    ApparelGraphicRecord apparelGraphicRecord = graphics.apparelGraphics[k];
                    if (apparelGraphicRecord.sourceApparel.def.apparel.LastLayer == ApparelLayerDefOf.Shell)
                    {
                        Material original3 = apparelGraphicRecord.graphic.MatAt(bodyFacing);
                        original3 = OverrideMaterialIfNeeded(original3, pawn);
                        GenDraw.DrawMeshNowOrLater(mesh, vector, quaternion, original3, portrait);
                    }
                }
            }
            if (!portrait && pawn.RaceProps.Animal && pawn.inventory != null && pawn.inventory.innerContainer.Count > 0 && graphics.packGraphic != null)
            {
                Graphics.DrawMesh(mesh, vector, quaternion, graphics.packGraphic.MatAt(bodyFacing), 0);
            }
            if (portrait)
            {
                return;
            }
            DrawEquipment(rootLoc);
            if (pawn.apparel != null)
            {
                List <Apparel> wornApparel = pawn.apparel.WornApparel;
                for (int l = 0; l < wornApparel.Count; l++)
                {
                    wornApparel[l].DrawWornExtras();
                }
            }
            Vector3 bodyLoc = rootLoc;

            bodyLoc.y += 0.0416666679f;
            statusOverlays.RenderStatusOverlays(bodyLoc, quaternion, MeshPool.humanlikeHeadSet.MeshAt(headFacing));
        }