コード例 #1
0
        public PlayerModel( Game window )
            : base(window)
        {
            vertices = new ModelVertex[boxVertices * ( 7 + 2 )];
            Set = new ModelSet();

            Set.Head = BuildBox( MakeBoxBounds( -4, 24, -4, 4, 32, 4 )
                                .SetTexOrigin( 0, 0 ) );
            Set.Torso = BuildBox( MakeBoxBounds( -4, 12, -2, 4, 24, 2 )
                                 .SetTexOrigin( 16, 16 ) );
            Set.LeftLeg = BuildBox( MakeBoxBounds( 0, 0, -2, -4, 12, 2 )
                                   .SetTexOrigin( 0, 16 ) );
            Set.RightLeg = BuildBox( MakeBoxBounds( 0, 0, -2, 4, 12, 2 ).
                                    SetTexOrigin( 0, 16 ) );
            Set.Hat = BuildBox( MakeBoxBounds( -4, 24, -4, 4, 32, 4 )
                               .SetTexOrigin( 32, 0 )
                               .SetModelBounds( -4.5f, 23.5f, -4.5f, 4.5f, 32.5f, 4.5f ) );
            Set.LeftArm = BuildBox( MakeBoxBounds( -4, 12, -2, -8, 24, 2 )
                                   .SetTexOrigin( 40, 16 ) );
            Set.RightArm = BuildBox( MakeBoxBounds( 4, 12, -2, 8, 24, 2 )
                                    .SetTexOrigin( 40, 16 ) );

            SetSlim = new ModelSet();
            SetSlim.Head = Set.Head;
            SetSlim.Torso = Set.Torso;
            SetSlim.LeftLeg = Set.LeftLeg;
            SetSlim.RightLeg = Set.RightLeg;
            SetSlim.LeftArm = BuildBox( MakeBoxBounds( -7, 12, -2, -4, 24, 2 )
                                       .SetTexOrigin( 32, 48 ) );
            SetSlim.RightArm = BuildBox( MakeBoxBounds( 4, 12, -2, 7, 24, 2 )
                                        .SetTexOrigin( 40, 16 ) );
            SetSlim.Hat = Set.Hat;
        }
コード例 #2
0
ファイル: SpiderModel.cs プロジェクト: umby24/ClassicalSharp
 public SpiderModel( Game window )
     : base(window)
 {
     vertices = new ModelVertex[partVertices * 5];
     Head = MakeHead();
     Link = MakeLink();
     End = MakeEnd();
     LeftLeg = MakeLeg( -19/16f, -3/16f );
     RightLeg = MakeLeg( 3/16f, 19/16f );
 }
コード例 #3
0
ファイル: ZombieModel.cs プロジェクト: umby24/ClassicalSharp
 public ZombieModel( Game window )
     : base(window)
 {
     vertices = new ModelVertex[partVertices * 6];
     Head = MakeHead();
     Torso = MakeTorso();
     LeftLeg = MakeLeftLeg( 4/16f, 0f );
     RightLeg = MakeRightLeg( 0, 4/16f );
     LeftArm = MakeLeftArm( 8/16f, 4/16f );
     RightArm = MakeRightArm( 4/16f, 8/16f );
 }
コード例 #4
0
ファイル: PigModel.cs プロジェクト: Daribon/ClassicalSharp
 public PigModel( Game window )
     : base(window)
 {
     vertices = new ModelVertex[boxVertices * 6];
     Head = MakeHead();
     Torso = MakeTorso();
     LeftLegFront = MakeLeg( -5/16f, -1/16f, -7/16f, -3/16f );
     RightLegFront = MakeLeg( 1/16f, 5/16f, -7/16f, -3/16f );
     LeftLegBack = MakeLeg( -5/16f, -1/16f, 5/16f, 9/16f );
     RightLegBack = MakeLeg( 1/16f, 5/16f, 5/16f, 9/16f );
 }
コード例 #5
0
 public SkeletonModel( Game window )
     : base(window)
 {
     vertices = new ModelVertex[boxVertices * 6];
     Head = MakeHead();
     Torso = MakeTorso();
     LeftLeg = MakeLeftLeg( 3/16f, 1/16f );
     RightLeg = MakeRightLeg( 1/16f, 3/16f );
     LeftArm = MakeLeftArm( 6/16f, 4/16f );
     RightArm = MakeRightArm( 4/16f, 6/16f );
 }
コード例 #6
0
ファイル: CreeperModel.cs プロジェクト: umby24/ClassicalSharp
 public CreeperModel( Game window )
     : base(window)
 {
     vertices = new ModelVertex[partVertices * 6];
     Head = MakeHead();
     Torso = MakeTorso();
     LeftLegFront = MakeLeg( -4/16f, 0, -6/16f, -2/16f );
     RightLegFront = MakeLeg( 0, 4/16f, -6/16f, -2/16f );
     LeftLegBack = MakeLeg( -4/16f, 0, 2/16f, 6/16f );
     RightLegBack = MakeLeg( 0, 4/16f, 2/16f, 6/16f );
 }
コード例 #7
0
ファイル: ChickenModel.cs プロジェクト: umby24/ClassicalSharp
 public ChickenModel( Game window )
     : base(window)
 {
     vertices = new ModelVertex[partVertices * 6 + planeVertices * 2 * 2];
     Head = MakeHead();
     Head2 = MakeHead2(); // TODO: Find a more appropriate name.
     Head3 = MakeHead3();
     Torso = MakeTorso();
     LeftLeg = MakeLeg( -3/16f, 0f, -2/16f, -1/16f );
     RightLeg = MakeLeg( 0f, 3/16f, 1/16f, 2/16f );
     LeftWing = MakeWing( -4/16f, -3/16f );
     RightWing = MakeWing( 3/16f, 4/16f );
 }
コード例 #8
0
        protected void DrawRotate(float angleX, float angleY, float angleZ, ModelPart part, bool head)
        {
            float           cosX = (float)Math.Cos(-angleX), sinX = (float)Math.Sin(-angleX);
            float           cosY = (float)Math.Cos(-angleY), sinY = (float)Math.Sin(-angleY);
            float           cosZ = (float)Math.Cos(-angleZ), sinZ = (float)Math.Sin(-angleZ);
            float           x = part.RotX, y = part.RotY, z = part.RotZ;
            VertexP3fT2fC4b vertex = default(VertexP3fT2fC4b);

            VertexP3fT2fC4b[] finVertices = game.ModelCache.vertices;

            for (int i = 0; i < part.Count; i++)
            {
                ModelVertex v = vertices[part.Offset + i];
                v.X -= x; v.Y -= y; v.Z -= z;
                float t = 0;

                // Rotate locally
                if (Rotate == RotateOrder.ZYX)
                {
                    t = cosZ * v.X + sinZ * v.Y; v.Y = -sinZ * v.X + cosZ * v.Y; v.X = t;                     // Inlined RotZ
                    t = cosY * v.X - sinY * v.Z; v.Z = sinY * v.X + cosY * v.Z; v.X = t;                      // Inlined RotY
                    t = cosX * v.Y + sinX * v.Z; v.Z = -sinX * v.Y + cosX * v.Z; v.Y = t;                     // Inlined RotX
                }
                else if (Rotate == RotateOrder.XZY)
                {
                    t = cosX * v.Y + sinX * v.Z; v.Z = -sinX * v.Y + cosX * v.Z; v.Y = t;                     // Inlined RotX
                    t = cosZ * v.X + sinZ * v.Y; v.Y = -sinZ * v.X + cosZ * v.Y; v.X = t;                     // Inlined RotZ
                    t = cosY * v.X - sinY * v.Z; v.Z = sinY * v.X + cosY * v.Z; v.X = t;                      // Inlined RotY
                }
                else if (Rotate == RotateOrder.YZX)
                {
                    t = cosY * v.X - sinY * v.Z; v.Z = sinY * v.X + cosY * v.Z; v.X = t;                      // Inlined RotY
                    t = cosZ * v.X + sinZ * v.Y; v.Y = -sinZ * v.X + cosZ * v.Y; v.X = t;                     // Inlined RotZ
                    t = cosX * v.Y + sinX * v.Z; v.Z = -sinX * v.Y + cosX * v.Z; v.Y = t;                     // Inlined RotX
                }

                // Rotate globally
                if (head)
                {
                    t = cosHead * v.X - sinHead * v.Z; v.Z = sinHead * v.X + cosHead * v.Z; v.X = t;                     // Inlined RotY
                }
                vertex.X      = v.X + x; vertex.Y = v.Y + y; vertex.Z = v.Z + z;
                vertex.Colour = cols[i >> 2];

                vertex.U             = (v.U & UVMask) * uScale - (v.U >> UVMaxShift) * 0.01f * uScale;
                vertex.V             = (v.V & UVMask) * vScale - (v.V >> UVMaxShift) * 0.01f * vScale;
                finVertices[index++] = vertex;
            }
        }
コード例 #9
0
 public SpiderModel( Game window )
     : base(window)
 {
     vertices = new ModelVertex[boxVertices * 5];
     Head = BuildBox( MakeBoxBounds( -4, 4, -11, 4, 12, -3 )
                     .SetTexOrigin( 32, 4 ) );
     Link = BuildBox( MakeBoxBounds( -3, 5, 3, 3, 11, -3 )
                    .SetTexOrigin( 0, 0 ) );
     End = BuildBox( MakeBoxBounds( -5, 4, 3, 5, 12, 15 )
                    .SetTexOrigin( 0, 12 ) );
     LeftLeg = BuildBox( MakeBoxBounds( -19, 7, -1, -3, 9, 1 )
                        .SetTexOrigin( 18, 0 ) );
     RightLeg = BuildBox( MakeBoxBounds( 3, 7, -1, 19, 9, 1 )
                        .SetTexOrigin( 18, 0 ) );
 }
コード例 #10
0
ファイル: CowModel.cs プロジェクト: Cheesse/More-Models
        public override void CreateParts()
        {
            vertices = new ModelVertex[boxVertices * boxesBuilt];

            head          = BuildBox(MakeBoxBounds(-4, 16, -14, 4, 24, -8).TexOrigin(0, 0).RotOrigin(0, 20, -6));
            rightHorn     = BuildBox(MakeBoxBounds(-5, 22, -13, -4, 25, -12).TexOrigin(22, 0).RotOrigin(0, 20, -6));
            leftHorn      = BuildBox(MakeBoxBounds(4, 22, -13, 5, 25, -12).TexOrigin(22, 0).RotOrigin(0, 20, -6));
            leftLegFront  = BuildBox(MakeBoxBounds(-6, 0, -8, -2, 12, -4).TexOrigin(0, 16).RotOrigin(0, 12, -5));
            rightLegFront = BuildBox(MakeBoxBounds(2, 0, -8, 6, 12, -4).TexOrigin(0, 16).RotOrigin(0, 12, -5));
            leftLegBack   = BuildBox(MakeBoxBounds(-6, 0, 5, -2, 12, 9).TexOrigin(0, 16).RotOrigin(0, 12, 7));
            rightLegBack  = BuildBox(MakeBoxBounds(2, 0, 5, 6, 12, 9).TexOrigin(0, 16).RotOrigin(0, 12, 7));

            torso = BuildRotatedBox(MakeRotatedBoxBounds(-6, 12, -8, 6, 22, 10).TexOrigin(18, 4));
            udder = BuildRotatedBox(MakeRotatedBoxBounds(-2, 11, 4, 2, 12, 10).TexOrigin(52, 0));
        }
コード例 #11
0
 public PigModel(Game window) : base(window)
 {
     vertices = new ModelVertex[boxVertices * 6];
     Head     = BuildBox(MakeBoxBounds(-4, 8, -14, 4, 16, -6)
                         .SetTexOrigin(0, 0));
     Torso = BuildRotatedBox(MakeRotatedBoxBounds(-5, 6, -8, 5, 14, 8)
                             .SetTexOrigin(28, 8));
     LeftLegFront = BuildBox(MakeBoxBounds(-5, 0, -7, -1, 6, -3)
                             .SetTexOrigin(0, 16));
     RightLegFront = BuildBox(MakeBoxBounds(1, 0, -7, 5, 6, -3)
                              .SetTexOrigin(0, 16));
     LeftLegBack = BuildBox(MakeBoxBounds(-5, 0, 5, -1, 6, 9)
                            .SetTexOrigin(0, 16));
     RightLegBack = BuildBox(MakeBoxBounds(1, 0, 5, 5, 6, 9)
                             .SetTexOrigin(0, 16));
 }
コード例 #12
0
 public ZombieModel(Game window) : base(window)
 {
     vertices = new ModelVertex[boxVertices * 6];
     Head     = BuildBox(MakeBoxBounds(-4, 24, -4, 4, 32, 4)
                         .SetTexOrigin(0, 0));
     Torso = BuildBox(MakeBoxBounds(-4, 12, -2, 4, 24, 2)
                      .SetTexOrigin(16, 16));
     LeftLeg = BuildBox(MakeBoxBounds(0, 0, -2, -4, 12, 2)
                        .SetTexOrigin(0, 16));
     RightLeg = BuildBox(MakeBoxBounds(0, 0, -2, 4, 12, 2)
                         .SetTexOrigin(0, 16));
     LeftArm = BuildBox(MakeBoxBounds(-4, 12, -2, -8, 24, 2)
                        .SetTexOrigin(40, 16));
     RightArm = BuildBox(MakeBoxBounds(4, 12, -2, 8, 24, 2)
                         .SetTexOrigin(40, 16));
 }
コード例 #13
0
 public SkeletonModel(Game window) : base(window)
 {
     vertices = new ModelVertex[boxVertices * 6];
     Head     = BuildBox(MakeBoxBounds(-4, 24, -4, 4, 32, 4)
                         .SetTexOrigin(0, 0));
     Torso = BuildBox(MakeBoxBounds(-4, 12, -2, 4, 24, 2)
                      .SetTexOrigin(16, 16));
     LeftLeg = BuildBox(MakeBoxBounds(-1, 0, -1, -3, 12, 1)
                        .SetTexOrigin(0, 16));
     RightLeg = BuildBox(MakeBoxBounds(1, 0, -1, 3, 12, 1)
                         .SetTexOrigin(0, 16));
     LeftArm = BuildBox(MakeBoxBounds(-4, 12, -1, -6, 24, 1)
                        .SetTexOrigin(40, 16));
     RightArm = BuildBox(MakeBoxBounds(4, 12, -1, 6, 24, 1)
                         .SetTexOrigin(40, 16));
 }
コード例 #14
0
        internal override void CreateParts()
        {
            vertices = new ModelVertex[boxVertices * (7 + 7 + 4)];
            Set = new ModelSet();
            MakeDescriptions();

            Set.Head = BuildBox( head.TexOrigin( 0, 0 ) );
            Set.Torso = BuildBox( torso.TexOrigin( 16, 16 ) );
            Set.LeftLeg = BuildBox( lLeg.MirrorX().TexOrigin( 0, 16 ) );
            Set.RightLeg = BuildBox( rLeg.TexOrigin( 0, 16 ) );
            Set.Hat = BuildBox( head.TexOrigin( 32, 0 ).Expand( offset ) );
            Set.LeftArm = BuildBox( lArm.MirrorX().TexOrigin( 40, 16 ) );
            Set.RightArm = BuildBox( rArm.TexOrigin( 40, 16 ) );
            lArm = lArm.MirrorX(); lLeg = lLeg.MirrorX();

            Set64 = new ModelSet();
            Set64.Head = Set.Head;
            Set64.Torso = Set.Torso;
            Set64.LeftLeg = BuildBox( lLeg.TexOrigin( 16, 48 ) );
            Set64.RightLeg = Set.RightLeg;
            Set64.Hat = Set.Hat;
            Set64.LeftArm = BuildBox( lArm.TexOrigin( 32, 48 ) );
            Set64.RightArm = Set.RightArm;

            Set64.TorsoLayer = BuildBox( torso.TexOrigin( 16, 32 ).Expand( offset ) );
            Set64.LeftLegLayer = BuildBox( lLeg.TexOrigin( 0, 48 ).Expand( offset ) );
            Set64.RightLegLayer = BuildBox( rLeg.TexOrigin( 0, 32 ).Expand( offset ) );
            Set64.LeftArmLayer = BuildBox( lArm.TexOrigin( 48, 48 ).Expand( offset ) );
            Set64.RightArmLayer = BuildBox( rArm.TexOrigin( 40, 32 ).Expand( offset ) );

            SetSlim = new ModelSet();
            SetSlim.Head = Set64.Head;
            SetSlim.Torso = Set64.Torso;
            SetSlim.LeftLeg = Set64.LeftLeg;
            SetSlim.RightLeg = Set64.RightLeg;
            SetSlim.Hat = Set64.Hat;
            lArm.BodyW -= 1; lArm.X1 += (offset * 2)/16f;
            SetSlim.LeftArm = BuildBox( lArm.TexOrigin( 32, 48 ) );
            rArm.BodyW -= 1; rArm.X2 -= (offset * 2)/16f;
            SetSlim.RightArm = BuildBox( rArm.TexOrigin( 40, 16 ) );

            SetSlim.TorsoLayer = Set64.TorsoLayer;
            SetSlim.LeftLegLayer = Set64.LeftLegLayer;
            SetSlim.RightLegLayer = Set64.RightLegLayer;
            SetSlim.LeftArmLayer = BuildBox( lArm.TexOrigin( 48, 48 ).Expand( offset ) );
            SetSlim.RightArmLayer = BuildBox( rArm.TexOrigin( 40, 32 ).Expand( offset ) );
        }
コード例 #15
0
        internal override void CreateParts()
        {
            vertices = new ModelVertex[boxVertices * (7 + 7 + 4)];
            Set      = new ModelSet();
            MakeDescriptions();

            Set.Head     = BuildBox(head.TexOrigin(0, 0));
            Set.Torso    = BuildBox(torso.TexOrigin(16, 16));
            Set.LeftLeg  = BuildBox(lLeg.MirrorX().TexOrigin(0, 16));
            Set.RightLeg = BuildBox(rLeg.TexOrigin(0, 16));
            Set.Hat      = BuildBox(head.TexOrigin(32, 0).Expand(offset));
            Set.LeftArm  = BuildBox(lArm.MirrorX().TexOrigin(40, 16));
            Set.RightArm = BuildBox(rArm.TexOrigin(40, 16));
            lArm         = lArm.MirrorX(); lLeg = lLeg.MirrorX();

            Set64          = new ModelSet();
            Set64.Head     = Set.Head;
            Set64.Torso    = Set.Torso;
            Set64.LeftLeg  = BuildBox(lLeg.TexOrigin(16, 48));
            Set64.RightLeg = Set.RightLeg;
            Set64.Hat      = Set.Hat;
            Set64.LeftArm  = BuildBox(lArm.TexOrigin(32, 48));
            Set64.RightArm = Set.RightArm;

            Set64.TorsoLayer    = BuildBox(torso.TexOrigin(16, 32).Expand(offset));
            Set64.LeftLegLayer  = BuildBox(lLeg.TexOrigin(0, 48).Expand(offset));
            Set64.RightLegLayer = BuildBox(rLeg.TexOrigin(0, 32).Expand(offset));
            Set64.LeftArmLayer  = BuildBox(lArm.TexOrigin(48, 48).Expand(offset));
            Set64.RightArmLayer = BuildBox(rArm.TexOrigin(40, 32).Expand(offset));

            SetSlim          = new ModelSet();
            SetSlim.Head     = Set64.Head;
            SetSlim.Torso    = Set64.Torso;
            SetSlim.LeftLeg  = Set64.LeftLeg;
            SetSlim.RightLeg = Set64.RightLeg;
            SetSlim.Hat      = Set64.Hat;
            lArm.BodyW      -= 1; lArm.X1 += (offset * 2) / 16f;
            SetSlim.LeftArm  = BuildBox(lArm.TexOrigin(32, 48));
            rArm.BodyW      -= 1; rArm.X2 -= (offset * 2) / 16f;
            SetSlim.RightArm = BuildBox(rArm.TexOrigin(40, 16));

            SetSlim.TorsoLayer    = Set64.TorsoLayer;
            SetSlim.LeftLegLayer  = Set64.LeftLegLayer;
            SetSlim.RightLegLayer = Set64.RightLegLayer;
            SetSlim.LeftArmLayer  = BuildBox(lArm.TexOrigin(48, 48).Expand(offset));
            SetSlim.RightArmLayer = BuildBox(rArm.TexOrigin(40, 32).Expand(offset));
        }
コード例 #16
0
 public ZombieModel( Game window )
     : base(window)
 {
     vertices = new ModelVertex[boxVertices * 6];
     Head = BuildBox( MakeBoxBounds( -4, 24, -4, 4, 32, 4 )
                     .SetTexOrigin( 0, 0 ) );
     Torso =  BuildBox( MakeBoxBounds( -4, 12, -2, 4, 24, 2 )
                       .SetTexOrigin( 16, 16 ) );
     LeftLeg =  BuildBox( MakeBoxBounds( 0, 0, -2, -4, 12, 2 )
                         .SetTexOrigin( 0, 16 ) );
     RightLeg = BuildBox( MakeBoxBounds( 0, 0, -2, 4, 12, 2 )
                         .SetTexOrigin( 0, 16 ) );
     LeftArm = BuildBox( MakeBoxBounds( -4, 12, -2, -8, 24, 2 )
                        .SetTexOrigin( 40, 16 ) );
     RightArm = BuildBox( MakeBoxBounds( 4, 12, -2, 8, 24, 2 )
                         .SetTexOrigin( 40, 16 ) );
 }
コード例 #17
0
 internal override void CreateParts()
 {
     vertices = new ModelVertex[boxVertices * 5];
     Head = BuildBox( MakeBoxBounds( -4, 4, -11, 4, 12, -3 )
                     .TexOrigin( 32, 4 )
                     .RotOrigin( 0, 8, -3 ) );
     Link = BuildBox( MakeBoxBounds( -3, 5, 3, 3, 11, -3 )
                     .TexOrigin( 0, 0 ) );
     End = BuildBox( MakeBoxBounds( -5, 4, 3, 5, 12, 15 )
                    .TexOrigin( 0, 12 ) );
     LeftLeg = BuildBox( MakeBoxBounds( -19, 7, -1, -3, 9, 1 )
                        .TexOrigin( 18, 0 )
                        .RotOrigin( -3, 8, 0 ) );
     RightLeg = BuildBox( MakeBoxBounds( 3, 7, -1, 19, 9, 1 )
                         .TexOrigin( 18, 0 )
                         .RotOrigin( 3, 8, 0 ) );
 }
コード例 #18
0
 public SkeletonModel( Game window )
     : base(window)
 {
     vertices = new ModelVertex[boxVertices * 6];
     Head = BuildBox( MakeBoxBounds( -4, 24, -4, 4, 32, 4 )
                     .SetTexOrigin( 0, 0 ) );
     Torso = BuildBox( MakeBoxBounds( -4, 12, -2, 4, 24, 2 )
                      .SetTexOrigin( 16, 16 ) );
     LeftLeg = BuildBox( MakeBoxBounds( -1, 0, -1, -3, 12, 1 )
                        .SetTexOrigin( 0, 16 ) );
     RightLeg = BuildBox( MakeBoxBounds( 1, 0, -1, 3, 12, 1 )
                             .SetTexOrigin( 0, 16 ) );
     LeftArm = BuildBox( MakeBoxBounds( -4, 12, -1, -6, 24, 1 )
                        .SetTexOrigin( 40, 16 ) );
     RightArm = BuildBox( MakeBoxBounds( 4, 12, -1, 6, 24, 1 )
                        .SetTexOrigin( 40, 16 ) );
 }
コード例 #19
0
        protected void DrawPart(ModelPart part)
        {
            float vScale = _64x64 ? 64f : 32f;

            for (int i = 0; i < part.Count; i++)
            {
                ModelVertex model  = vertices[part.Offset + i];
                Vector3     newPos = Utils.RotateY(model.X, model.Y, model.Z, cosA, sinA) + pos;

                FastColour            col    = GetCol(i, part.Count);
                VertexPos3fTex2fCol4b vertex = default(VertexPos3fTex2fCol4b);
                vertex.X = newPos.X; vertex.Y = newPos.Y; vertex.Z = newPos.Z;
                vertex.R = col.R; vertex.G = col.G; vertex.B = col.B; vertex.A = 255;
                AdjustUV(model.U, model.V, vScale, i, ref vertex);
                cache.vertices[index++] = vertex;
            }
        }
コード例 #20
0
ファイル: IModel.cs プロジェクト: depeapa/ClassicalSharp
        protected void DrawPart(ModelPart part)
        {
            VertexP3fT2fC4b vertex = default(VertexP3fT2fC4b);

            VertexP3fT2fC4b[] finVertices = game.ModelCache.vertices;

            for (int i = 0; i < part.Count; i++)
            {
                ModelVertex v = vertices[part.Offset + i];
                vertex.X      = v.X; vertex.Y = v.Y; vertex.Z = v.Z;
                vertex.Colour = cols[i >> 2];

                vertex.U             = (v.U & UVMask) * uScale - (v.U >> UVMaxShift) * 0.01f * uScale;
                vertex.V             = (v.V & UVMask) * vScale - (v.V >> UVMaxShift) * 0.01f * vScale;
                finVertices[index++] = vertex;
            }
        }
コード例 #21
0
 public PigModel( Game window )
     : base(window)
 {
     vertices = new ModelVertex[boxVertices * 6];
     Head = BuildBox( MakeBoxBounds( -4, 8, -14, 4, 16, -6 )
                    .SetTexOrigin( 0, 0 ) );
     Torso = BuildRotatedBox( MakeRotatedBoxBounds( -5, 6, -8, 5, 14, 8 )
                             .SetTexOrigin( 28, 8 ) );
     LeftLegFront = BuildBox( MakeBoxBounds( -5, 0, -7, -1, 6, -3 )
                             .SetTexOrigin( 0, 16 ) );
     RightLegFront = BuildBox( MakeBoxBounds( 1, 0, -7, 5, 6, -3 )
                              .SetTexOrigin( 0, 16 ) );
     LeftLegBack = BuildBox( MakeBoxBounds( -5, 0, 5, -1, 6, 9 )
                            .SetTexOrigin( 0, 16 ) );
     RightLegBack = BuildBox( MakeBoxBounds( 1, 0, 5, 5, 6, 9 )
                             .SetTexOrigin( 0, 16 ) );
 }
コード例 #22
0
 internal override void CreateParts()
 {
     vertices = new ModelVertex[boxVertices * 5];
     Head     = BuildBox(MakeBoxBounds(-4, 4, -11, 4, 12, -3)
                         .TexOrigin(32, 4)
                         .RotOrigin(0, 8, -3));
     Link = BuildBox(MakeBoxBounds(-3, 5, 3, 3, 11, -3)
                     .TexOrigin(0, 0));
     End = BuildBox(MakeBoxBounds(-5, 4, 3, 5, 12, 15)
                    .TexOrigin(0, 12));
     LeftLeg = BuildBox(MakeBoxBounds(-19, 7, -1, -3, 9, 1)
                        .TexOrigin(18, 0)
                        .RotOrigin(-3, 8, 0));
     RightLeg = BuildBox(MakeBoxBounds(3, 7, -1, 19, 9, 1)
                         .TexOrigin(18, 0)
                         .RotOrigin(3, 8, 0));
 }
コード例 #23
0
        public CreeperModel(Game window) : base(window)
        {
            vertices = new ModelVertex[boxVertices * 6];
            Head     = BuildBox(MakeBoxBounds(-4, 18, -4, 4, 26, 4)
                                .SetTexOrigin(0, 0));
            Torso = BuildBox(MakeBoxBounds(-4, 6, -2, 4, 18, 2)
                             .SetTexOrigin(16, 16));

            LeftLegFront = BuildBox(MakeBoxBounds(-4, 0, -6, 0, 6, -2)
                                    .SetTexOrigin(0, 16));
            RightLegFront = BuildBox(MakeBoxBounds(0, 0, -6, 4, 6, -2)
                                     .SetTexOrigin(0, 16));
            LeftLegBack = BuildBox(MakeBoxBounds(-4, 0, 2, 0, 6, 6)
                                   .SetTexOrigin(0, 16));
            RightLegBack = BuildBox(MakeBoxBounds(0, 0, 2, 4, 6, 6)
                                    .SetTexOrigin(0, 16));
        }
コード例 #24
0
        public CreeperModel( Game window )
            : base(window)
        {
            vertices = new ModelVertex[boxVertices * 6];
            Head =  BuildBox( MakeBoxBounds( -4, 18, -4, 4, 26, 4 )
                             .SetTexOrigin( 0, 0 ) );
            Torso = BuildBox( MakeBoxBounds( -4, 6, -2, 4, 18, 2 )
                             .SetTexOrigin( 16, 16 ) );

            LeftLegFront = BuildBox( MakeBoxBounds( -4, 0, -6, 0, 6, -2 )
                     .SetTexOrigin( 0, 16 ) );
            RightLegFront = BuildBox( MakeBoxBounds( 0, 0, -6, 4, 6, -2 )
                     .SetTexOrigin( 0, 16 ) );
            LeftLegBack = BuildBox( MakeBoxBounds( -4, 0, 2, 0, 6, 6 )
                     .SetTexOrigin( 0, 16 ) );
            RightLegBack = BuildBox( MakeBoxBounds( 0, 0, 2, 4, 6, 6 )
                     .SetTexOrigin( 0, 16 ) );
        }
コード例 #25
0
ファイル: SheepModel.cs プロジェクト: Daribon/ClassicalSharp
 public SheepModel( Game window )
     : base(window)
 {
     vertices = new ModelVertex[boxVertices * 6 * ( Fur ? 2 : 1 )];
     Head = MakeHead();
     Torso = MakeTorso();
     LeftLegFront = MakeLeg( -5/16f, -1/16f, -7/16f, -3/16f );
     RightLegFront = MakeLeg( 1/16f, 5/16f, -7/16f, -3/16f );
     LeftLegBack = MakeLeg( -5/16f, -1/16f, 5/16f, 9/16f );
     RightLegBack = MakeLeg( 1/16f, 5/16f, 5/16f, 9/16f );
     if( Fur ) {
         FurHead = MakeFurHead();
         FurTorso = MakeFurTorso();
         FurLeftLegFront = MakeFurLeg( -5.5f/16f, -0.5f/16f, -7.5f/16f, -2.5f/16f );
         FurRightLegFront = MakeFurLeg( 0.5f/16f, 5.5f/16f, -7.5f/16f, -2.5f/16f );
         FurLeftLegBack = MakeFurLeg( -5.5f/16f, -0.5f/16f, 4.5f/16f, 9.5f/16f );
         FurRightLegBack = MakeFurLeg( 0.5f/16f, 5.5f/16f, 4.5f/16f, 9.5f/16f );
     }
 }
コード例 #26
0
        public ChickenModel(Game window) : base(window)
        {
            vertices = new ModelVertex[boxVertices * 6 + quadVertices * 2 * 2];
            Head     = BuildBox(MakeBoxBounds(-2, 9, -6, 2, 15, -3)
                                .SetTexOrigin(0, 0));
            Head2 = BuildBox(MakeBoxBounds(-1, 9, -7, 1, 11, -5)
                             .SetTexOrigin(14, 4));                // TODO: Find a more appropriate name.
            Head3 = BuildBox(MakeBoxBounds(-2, 11, -8, 2, 13, -6)
                             .SetTexOrigin(14, 0));
            Torso = BuildRotatedBox(MakeRotatedBoxBounds(-3, 5, -4, 3, 11, 3)
                                    .SetTexOrigin(0, 9));

            LeftLeg  = MakeLeg(-3, 0, -2, -1);
            RightLeg = MakeLeg(0, 3, 1, 2);
            LeftWing = BuildBox(MakeBoxBounds(-4, 7, -3, -3, 11, 3)
                                .SetTexOrigin(24, 13));
            RightWing = BuildBox(MakeBoxBounds(3, 7, -3, 4, 11, 3)
                                 .SetTexOrigin(24, 13));
        }
コード例 #27
0
 public SheepModel( Game window )
     : base(window)
 {
     vertices = new ModelVertex[boxVertices * 6 * ( Fur ? 2 : 1 )];
     Head = BuildBox( MakeBoxBounds( -3, 16, -14, 3, 22, -6 )
                     .SetTexOrigin( 0, 0 ) );
     Torso = BuildRotatedBox( MakeRotatedBoxBounds( -4, 12, -8, 4, 18, 8 )
                             .SetTexOrigin( 28, 8 ) );
     LeftLegFront = BuildBox( MakeBoxBounds( -5, 0, -7, -1, 12, -3 )
                             .SetTexOrigin( 0, 16 ) );
     RightLegFront = BuildBox( MakeBoxBounds( 1, 0, -7, 5, 12, -3 )
                              .SetTexOrigin( 0, 16 ) );
     LeftLegBack = BuildBox( MakeBoxBounds( -5, 0, 5, -1, 12, 9 )
                            .SetTexOrigin( 0, 16 ) );
     RightLegBack = BuildBox( MakeBoxBounds( 1, 0, 5, 5, 12, 9 )
                             .SetTexOrigin( 0, 16 ) );
     if( Fur )
         MakeFurModel();
 }
コード例 #28
0
 public SheepModel(Game window) : base(window)
 {
     vertices = new ModelVertex[boxVertices * 6 * (Fur ? 2 : 1)];
     Head     = BuildBox(MakeBoxBounds(-3, 16, -14, 3, 22, -6)
                         .SetTexOrigin(0, 0));
     Torso = BuildRotatedBox(MakeRotatedBoxBounds(-4, 12, -8, 4, 18, 8)
                             .SetTexOrigin(28, 8));
     LeftLegFront = BuildBox(MakeBoxBounds(-5, 0, -7, -1, 12, -3)
                             .SetTexOrigin(0, 16));
     RightLegFront = BuildBox(MakeBoxBounds(1, 0, -7, 5, 12, -3)
                              .SetTexOrigin(0, 16));
     LeftLegBack = BuildBox(MakeBoxBounds(-5, 0, 5, -1, 12, 9)
                            .SetTexOrigin(0, 16));
     RightLegBack = BuildBox(MakeBoxBounds(1, 0, 5, 5, 12, 9)
                             .SetTexOrigin(0, 16));
     if (Fur)
     {
         MakeFurModel();
     }
 }
コード例 #29
0
ファイル: PigModel.cs プロジェクト: Retatta/ClassicalSharp
 internal override void CreateParts()
 {
     vertices = new ModelVertex[boxVertices * 6];
     Head = BuildBox( MakeBoxBounds( -4, 8, -14, 4, 16, -6 )
                    .TexOrigin( 0, 0 )
                    .RotOrigin( 0, 12, -6 ) );
     Torso = BuildRotatedBox( MakeRotatedBoxBounds( -5, 6, -8, 5, 14, 8 )
                             .TexOrigin( 28, 8 ) );
     LeftLegFront = BuildBox( MakeBoxBounds( -5, 0, -7, -1, 6, -3 )
                             .TexOrigin( 0, 16 )
                             .RotOrigin( 0, 6, -5 ) );
     RightLegFront = BuildBox( MakeBoxBounds( 1, 0, -7, 5, 6, -3 )
                              .TexOrigin( 0, 16 )
                              .RotOrigin( 0, 6, -5 ) );
     LeftLegBack = BuildBox( MakeBoxBounds( -5, 0, 5, -1, 6, 9 )
                            .TexOrigin( 0, 16 )
                            .RotOrigin( 0, 6, 7 ) );
     RightLegBack = BuildBox( MakeBoxBounds( 1, 0, 5, 5, 6, 9 )
                             .TexOrigin( 0, 16 )
                             .RotOrigin( 0, 6, 7 ) );
 }
コード例 #30
0
 public override void CreateParts()
 {
     vertices = new ModelVertex[boxVertices * 6];
     Head     = BuildBox(MakeBoxBounds(-4, 24, -4, 4, 32, 4)
                         .TexOrigin(0, 0)
                         .RotOrigin(0, 24, 0));
     Torso = BuildBox(MakeBoxBounds(-4, 12, -2, 4, 24, 2)
                      .TexOrigin(16, 16));
     LeftLeg = BuildBox(MakeBoxBounds(-1, 0, -1, -3, 12, 1)
                        .TexOrigin(0, 16)
                        .RotOrigin(0, 12, 0));
     RightLeg = BuildBox(MakeBoxBounds(1, 0, -1, 3, 12, 1)
                         .TexOrigin(0, 16)
                         .RotOrigin(0, 12, 0));
     LeftArm = BuildBox(MakeBoxBounds(-4, 12, -1, -6, 24, 1)
                        .TexOrigin(40, 16)
                        .RotOrigin(-5, 23, 0));
     RightArm = BuildBox(MakeBoxBounds(4, 12, -1, 6, 24, 1)
                         .TexOrigin(40, 16)
                         .RotOrigin(5, 23, 0));
 }
コード例 #31
0
 internal override void CreateParts()
 {
     vertices = new ModelVertex[boxVertices * 6];
     Head     = BuildBox(MakeBoxBounds(-4, 24, -4, 4, 32, 4)
                         .TexOrigin(0, 0)
                         .RotOrigin(0, 24, 0));
     Torso = BuildBox(MakeBoxBounds(-4, 12, -2, 4, 24, 2)
                      .TexOrigin(16, 16));
     LeftLeg = BuildBox(MakeBoxBounds(0, 0, -2, -4, 12, 2)
                        .TexOrigin(0, 16)
                        .RotOrigin(0, 12, 0));
     RightLeg = BuildBox(MakeBoxBounds(0, 0, -2, 4, 12, 2)
                         .TexOrigin(0, 16)
                         .RotOrigin(0, 12, 0));
     LeftArm = BuildBox(MakeBoxBounds(-4, 12, -2, -8, 24, 2)
                        .TexOrigin(40, 16)
                        .RotOrigin(-6, 22, 0));
     RightArm = BuildBox(MakeBoxBounds(4, 12, -2, 8, 24, 2)
                         .TexOrigin(40, 16)
                         .RotOrigin(6, 22, 0));
 }
コード例 #32
0
 internal override void CreateParts()
 {
     vertices = new ModelVertex[boxVertices * 6];
     Head = BuildBox( MakeBoxBounds( -4, 24, -4, 4, 32, 4 )
                     .TexOrigin( 0, 0 )
                     .RotOrigin( 0, 24, 0 ) );
     Torso = BuildBox( MakeBoxBounds( -4, 12, -2, 4, 24, 2 )
                      .TexOrigin( 16, 16 ) );
     LeftLeg = BuildBox( MakeBoxBounds( -1, 0, -1, -3, 12, 1 )
                        .TexOrigin( 0, 16 )
                        .RotOrigin( 0, 12, 0 ) );
     RightLeg = BuildBox( MakeBoxBounds( 1, 0, -1, 3, 12, 1 )
                         .TexOrigin( 0, 16 )
                         .RotOrigin( 0, 12, 0 ) );
     LeftArm = BuildBox( MakeBoxBounds( -4, 12, -1, -6, 24, 1 )
                        .TexOrigin( 40, 16 )
                        .RotOrigin( -5, 23, 0 ) );
     RightArm = BuildBox( MakeBoxBounds( 4, 12, -1, 6, 24, 1 )
                         .TexOrigin( 40, 16 )
                         .RotOrigin( 5, 23, 0 ) );
 }
コード例 #33
0
 /// <inheritdoc/>
 public override void CreateParts()
 {
     vertices = new ModelVertex[boxVertices * 6];
     Head     = BuildBox(MakeBoxBounds(-4, 8, -14, 4, 16, -6)
                         .TexOrigin(0, 0)
                         .RotOrigin(0, 12, -6));
     Torso = BuildRotatedBox(MakeRotatedBoxBounds(-5, 6, -8, 5, 14, 8)
                             .TexOrigin(28, 8));
     LeftLegFront = BuildBox(MakeBoxBounds(-5, 0, -7, -1, 6, -3)
                             .TexOrigin(0, 16)
                             .RotOrigin(0, 6, -5));
     RightLegFront = BuildBox(MakeBoxBounds(1, 0, -7, 5, 6, -3)
                              .TexOrigin(0, 16)
                              .RotOrigin(0, 6, -5));
     LeftLegBack = BuildBox(MakeBoxBounds(-5, 0, 5, -1, 6, 9)
                            .TexOrigin(0, 16)
                            .RotOrigin(0, 6, 7));
     RightLegBack = BuildBox(MakeBoxBounds(1, 0, 5, 5, 6, 9)
                             .TexOrigin(0, 16)
                             .RotOrigin(0, 6, 7));
 }
コード例 #34
0
        internal override void CreateParts()
        {
            vertices = new ModelVertex[boxVertices * 6];
            Head =  BuildBox( MakeBoxBounds( -4, 18, -4, 4, 26, 4 )
                             .TexOrigin( 0, 0 )
                             .RotOrigin( 0, 18, 0 ) );
            Torso = BuildBox( MakeBoxBounds( -4, 6, -2, 4, 18, 2 )
                             .TexOrigin( 16, 16 ) );

            LeftLegFront = BuildBox( MakeBoxBounds( -4, 0, -6, 0, 6, -2 )
                                    .TexOrigin( 0, 16 )
                                    .RotOrigin( 0, 6, -2 ) );
            RightLegFront = BuildBox( MakeBoxBounds( 0, 0, -6, 4, 6, -2 )
                                     .TexOrigin( 0, 16 )
                                     .RotOrigin( 0, 6, -2 ) );
            LeftLegBack = BuildBox( MakeBoxBounds( -4, 0, 2, 0, 6, 6 )
                                   .TexOrigin( 0, 16 )
                                   .RotOrigin( 0, 6, 2 ) );
            RightLegBack = BuildBox( MakeBoxBounds( 0, 0, 2, 4, 6, 6 )
                                    .TexOrigin( 0, 16 )
                                    .RotOrigin( 0, 6, 2 ) );
        }
コード例 #35
0
        public override void CreateParts()
        {
            vertices = new ModelVertex[boxVertices * 6];
            Head     = BuildBox(MakeBoxBounds(-4, 18, -4, 4, 26, 4)
                                .TexOrigin(0, 0)
                                .RotOrigin(0, 18, 0));
            Torso = BuildBox(MakeBoxBounds(-4, 6, -2, 4, 18, 2)
                             .TexOrigin(16, 16));

            LeftLegFront = BuildBox(MakeBoxBounds(-4, 0, -6, 0, 6, -2)
                                    .TexOrigin(0, 16)
                                    .RotOrigin(0, 6, -2));
            RightLegFront = BuildBox(MakeBoxBounds(0, 0, -6, 4, 6, -2)
                                     .TexOrigin(0, 16)
                                     .RotOrigin(0, 6, -2));
            LeftLegBack = BuildBox(MakeBoxBounds(-4, 0, 2, 0, 6, 6)
                                   .TexOrigin(0, 16)
                                   .RotOrigin(0, 6, 2));
            RightLegBack = BuildBox(MakeBoxBounds(0, 0, 2, 4, 6, 6)
                                    .TexOrigin(0, 16)
                                    .RotOrigin(0, 6, 2));
        }
コード例 #36
0
 internal override void CreateParts()
 {
     vertices = new ModelVertex[boxVertices * 6 * ( Fur ? 2 : 1 )];
     Head = BuildBox( MakeBoxBounds( -3, 16, -14, 3, 22, -6 )
                     .TexOrigin( 0, 0 )
                     .RotOrigin( 0, 18, -8 ) );
     Torso = BuildRotatedBox( MakeRotatedBoxBounds( -4, 12, -8, 4, 18, 8 )
                             .TexOrigin( 28, 8 ) );
     LeftLegFront = BuildBox( MakeBoxBounds( -5, 0, -7, -1, 12, -3 )
                             .TexOrigin( 0, 16 )
                             .RotOrigin( 0, 12, -5 ) );
     RightLegFront = BuildBox( MakeBoxBounds( 1, 0, -7, 5, 12, -3 )
                              .TexOrigin( 0, 16 )
                              .RotOrigin( 0, 12, -5 ) );
     LeftLegBack = BuildBox( MakeBoxBounds( -5, 0, 5, -1, 12, 9 )
                            .TexOrigin( 0, 16 )
                            .RotOrigin( 0, 12, 7 ) );
     RightLegBack = BuildBox( MakeBoxBounds( 1, 0, 5, 5, 12, 9 )
                             .TexOrigin( 0, 16 )
                             .RotOrigin( 0, 12, 7 ) );
     if( Fur ) MakeFurModel();
 }
コード例 #37
0
ファイル: PlayerModel.cs プロジェクト: lavajoe/ClassicalSharp
        public PlayerModel( Game window )
            : base(window)
        {
            vertices = new ModelVertex[partVertices * ( 7 + 2 )];
            Set = new ModelSet();
            Set.Head = MakeHead( false );
            Set.Torso = MakeTorso( false );
            Set.LeftLeg = MakeLeftLeg( 0, 16, 4/16f, 0f, false );
            Set.RightLeg = MakeRightLeg( 0, 16, 0, 4/16f, false );
            Set.LeftArm = MakeLeftArm( 40, 16, 8/16f, 4/16f, 4, false );
            Set.RightArm = MakeRightArm( 40, 16, 4/16f, 8/16f, 4, false );
            Set.Hat = MakeHat( false );

            SetSlim = new ModelSet();
            SetSlim.Head = Set.Head;
            SetSlim.Torso = Set.Torso;
            SetSlim.LeftLeg = Set.LeftLeg;
            SetSlim.RightLeg = Set.RightLeg;
            SetSlim.LeftArm = MakeLeftArm( 32, 48, 4/16f, 7/16f, 3, true );
            SetSlim.RightArm = MakeRightArm( 40, 16, 4/16f, 7/16f, 3, true );
            SetSlim.Hat = Set.Hat;
        }
コード例 #38
0
        /// <summary>Builds a box model assuming the follow texture layout:<br/>
        /// let SW = sides width, BW = body width, BH = body height<br/>
        /// ┏━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓ <br/>
        /// ┃┈┈┈┈┈SW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┈┃┈┈┈┈┈┈┈┈┈┈┈┈┃ <br/>
        /// ┃S┈┈┈┈┈┈┈┈┈┈┈S┃S┈┈┈┈front┈┈┈S┃S┈┈┈back┈┈┈┈S┃┈┈┈┈┈┈┈┈┈┈┈┈┃ <br/>
        /// ┃W┈┈┈┈┈┈┈┈┈W┃W┈┈┈┈tex┈┈┈W┃W┈┈┈┈tex┈┈┈┈W┃┈┈┈┈┈┈┈┈┈┈┈┈┃ <br/>
        /// ┃┈┈┈┈┈SW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┈┃┈┈┈┈┈┈┈┈┈┈┈┈┃ <br/>
        /// ┣━━━━━━━━━━━━━╋━━━━━━━━━━━━━╋━━━━━━━━━━━━━━╋━━━━━━━━━━━━┃ <br/>
        /// ┃┈┈┈┈┈SW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┃┈┈┈┈┈SW┈┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┃ <br/>
        /// ┃B┈┈┈left┈┈┈┈┈B┃B┈┈bottom┈┈B┃B┈┈┈right┈┈┈┈B┃B┈┈┈┈top┈┈┈B┃ <br/>
        /// ┃H┈┈┈tex┈┈┈┈┈H┃H┈┈tex┈┈┈┈┈H┃H┈┈┈tex┈┈┈┈┈H┃H┈┈┈┈tex┈┈┈H┃ <br/>
        /// ┃┈┈┈┈┈SW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┃┈┈┈┈┈SW┈┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┃ <br/>
        /// ┗━━━━━━━━━━━━━┻━━━━━━━━━━━━━┻━━━━━━━━━━━━━┻━━━━━━━━━━━━━┛ </summary>
        public static ModelPart BuildRotatedBox(IModel m, BoxDesc desc)
        {
            int   sidesW = desc.SizeY, bodyW = desc.SizeX, bodyH = desc.SizeZ;
            float x1 = desc.X1, y1 = desc.Y1, z1 = desc.Z1;
            float x2 = desc.X2, y2 = desc.Y2, z2 = desc.Z2;
            int   x = desc.TexX, y = desc.TexY;

            YQuad(m, x + sidesW + bodyW + sidesW, y + sidesW, bodyW, bodyH, x1, x2, z1, z2, y2, false);              // top
            YQuad(m, x + sidesW, y + sidesW, bodyW, bodyH, x2, x1, z1, z2, y1, false);                               // bottom
            ZQuad(m, x + sidesW, y, bodyW, sidesW, x2, x1, y1, y2, z1, false);                                       // front
            ZQuad(m, x + sidesW + bodyW, y, bodyW, sidesW, x1, x2, y2, y1, z2, false);                               // back
            XQuad(m, x, y + sidesW, sidesW, bodyH, y2, y1, z2, z1, x2, false);                                       // right
            XQuad(m, x + sidesW + bodyW, y + sidesW, sidesW, bodyH, y1, y2, z2, z1, x1, false);                      // left

            // rotate left and right 90 degrees
            for (int i = m.index - 8; i < m.index; i++)
            {
                ModelVertex vertex = m.vertices[i];
                float       z      = vertex.Z; vertex.Z = vertex.Y; vertex.Y = z;
                m.vertices[i] = vertex;
            }
            return(new ModelPart(m.index - 6 * 4, 6 * 4, desc.RotX, desc.RotY, desc.RotZ));
        }
コード例 #39
0
        /// <summary>Builds a box model assuming the follow texture layout:<br/>
        /// let SW = sides width, BW = body width, BH = body height<br/>
        /// ┏━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓ <br/>
        /// ┃┈┈┈┈┈SW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┈┃┈┈┈┈┈┈┈┈┈┈┈┈┃ <br/>
        /// ┃S┈┈┈┈┈┈┈┈┈┈┈S┃S┈┈┈┈front┈┈┈S┃S┈┈┈back┈┈┈┈S┃┈┈┈┈┈┈┈┈┈┈┈┈┃ <br/>
        /// ┃W┈┈┈┈┈┈┈┈┈W┃W┈┈┈┈tex┈┈┈W┃W┈┈┈┈tex┈┈┈┈W┃┈┈┈┈┈┈┈┈┈┈┈┈┃ <br/>
        /// ┃┈┈┈┈┈SW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┈┃┈┈┈┈┈┈┈┈┈┈┈┈┃ <br/>
        /// ┣━━━━━━━━━━━━━╋━━━━━━━━━━━━━╋━━━━━━━━━━━━━━╋━━━━━━━━━━━━┃ <br/>
        /// ┃┈┈┈┈┈SW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┃┈┈┈┈┈SW┈┈┈┈┈┈┃┈┈┈┈┈SW┈┈┈┈┃ <br/>
        /// ┃B┈┈┈left┈┈┈┈┈B┃B┈┈bottom┈┈B┃B┈┈┈right┈┈┈┈B┃B┈┈┈┈top┈┈┈B┃ <br/>
        /// ┃H┈┈┈tex┈┈┈┈┈H┃H┈┈tex┈┈┈┈┈H┃H┈┈┈tex┈┈┈┈┈H┃H┈┈┈┈tex┈┈┈H┃ <br/>
        /// ┃┈┈┈┈┈SW┈┈┈┈┈┃┈┈┈┈┈BW┈┈┈┈┈┃┈┈┈┈┈SW┈┈┈┈┈┈┃┈┈┈┈┈SW┈┈┈┈┃ <br/>
        /// ┗━━━━━━━━━━━━━┻━━━━━━━━━━━━━┻━━━━━━━━━━━━━┻━━━━━━━━━━━━━┛ </summary>
        protected ModelPart BuildRotatedBox(BoxDescription desc)
        {
            int   sidesW = desc.SidesW, bodyW = desc.BodyW, bodyH = desc.BodyH;
            float x1 = desc.X1, y1 = desc.Y1, z1 = desc.Z1;
            float x2 = desc.X2, y2 = desc.Y2, z2 = desc.Z2;
            int   x = desc.TexX, y = desc.TexY;

            YQuad(x + sidesW + bodyW + sidesW, y + sidesW, bodyW, bodyH, x1, x2, z1, z2, y2); // top
            YQuad(x + sidesW, y + sidesW, bodyW, bodyH, x2, x1, z1, z2, y1);                  // bottom
            ZQuad(x + sidesW, y, bodyW, sidesW, x2, x1, y1, y2, z1);                          // front
            ZQuad(x + sidesW + bodyW, y, bodyW, sidesW, x1, x2, y2, y1, z2);                  // back
            XQuad(x, y + sidesW, sidesW, bodyH, y2, y1, z2, z1, x2);                          // left
            XQuad(x + sidesW + bodyW, y + sidesW, sidesW, bodyH, y1, y2, z2, z1, x1);         // right

            // rotate left and right 90 degrees
            for (int i = index - 8; i < index; i++)
            {
                ModelVertex vertex = vertices[i];
                float       z      = vertex.Z; vertex.Z = vertex.Y; vertex.Y = z;
                vertices[i] = vertex;
            }
            return(new ModelPart(index - 6 * 4, 6 * 4));
        }
コード例 #40
0
        internal override void CreateParts()
        {
            vertices = new ModelVertex[boxVertices * 6 + quadVertices * 2 * 2];
            Head = BuildBox( MakeBoxBounds( -2, 9, -6, 2, 15, -3 )
                            .TexOrigin( 0, 0 )
                            .RotOrigin( 0, 9, -4 ) );
            Head2 = BuildBox( MakeBoxBounds( -1, 9, -7, 1, 11, -5 )
                             .TexOrigin( 14, 4 ) // TODO: Find a more appropriate name.
                             .RotOrigin( 0, 9, -4 ) );
            Head3 = BuildBox( MakeBoxBounds( -2, 11, -8, 2, 13, -6 )
                             .TexOrigin( 14, 0 )
                             .RotOrigin( 0, 9, -4 ) );
            Torso = BuildRotatedBox( MakeRotatedBoxBounds( -3, 5, -4, 3, 11, 3 )
                                   .TexOrigin( 0, 9 ) );

            LeftLeg = MakeLeg( -3, 0, -2, -1 );
            RightLeg = MakeLeg( 0, 3, 1, 2 );
            LeftWing = BuildBox( MakeBoxBounds( -4, 7, -3, -3, 11, 3 )
                                .TexOrigin( 24, 13 )
                                .RotOrigin( -3, 11, 0 ) );
            RightWing = BuildBox( MakeBoxBounds( 3, 7, -3, 4, 11, 3 )
                                 .TexOrigin( 24, 13 )
                                 .RotOrigin( 3, 11, 0 ) );
        }
コード例 #41
0
        internal override void CreateParts()
        {
            vertices = new ModelVertex[boxVertices * 6 + quadVertices * 2 * 2];
            Head     = BuildBox(MakeBoxBounds(-2, 9, -6, 2, 15, -3)
                                .TexOrigin(0, 0)
                                .RotOrigin(0, 9, -4));
            Head2 = BuildBox(MakeBoxBounds(-1, 9, -7, 1, 11, -5)
                             .TexOrigin(14, 4)               // TODO: Find a more appropriate name.
                             .RotOrigin(0, 9, -4));
            Head3 = BuildBox(MakeBoxBounds(-2, 11, -8, 2, 13, -6)
                             .TexOrigin(14, 0)
                             .RotOrigin(0, 9, -4));
            Torso = BuildRotatedBox(MakeRotatedBoxBounds(-3, 5, -4, 3, 11, 3)
                                    .TexOrigin(0, 9));

            LeftLeg  = MakeLeg(-3, 0, -2, -1);
            RightLeg = MakeLeg(0, 3, 1, 2);
            LeftWing = BuildBox(MakeBoxBounds(-4, 7, -3, -3, 11, 3)
                                .TexOrigin(24, 13)
                                .RotOrigin(-3, 11, 0));
            RightWing = BuildBox(MakeBoxBounds(3, 7, -3, 4, 11, 3)
                                 .TexOrigin(24, 13)
                                 .RotOrigin(3, 11, 0));
        }
コード例 #42
0
        public ChibiModel(Game window) : base(window)
        {
            vertices = new ModelVertex[boxVertices * (7 + 2)];

            Head = BuildBox(MakeBoxBounds(-4, 12, -4, 4, 20, 4)
                            .SetTexOrigin(0, 0));
            Hat = BuildBox(MakeBoxBounds(-4, 12, -4, 4, 20, 4)
                           .SetTexOrigin(32, 0).ExpandBounds(0.25f));
            Torso = BuildBox(MakeBoxBounds(-4, -6, -2, 4, 6, 2)
                             .SetTexOrigin(16, 16)
                             .SetModelBounds(-2, 6, -1, 2, 12, 1));
            LeftLeg = BuildBox(MakeBoxBounds(-2, -6, -2, 2, 6, 2)
                               .SetTexOrigin(0, 16)
                               .SetModelBounds(-0, 0, -1, -2, 6, 1));
            RightLeg = BuildBox(MakeBoxBounds(-2, -6, -2, 2, 6, 2)
                                .SetTexOrigin(0, 16)
                                .SetModelBounds(0, 0, -1, 2, 6, 1));
            LeftArm = BuildBox(MakeBoxBounds(-2, -6, -2, 2, 6, 2)
                               .SetTexOrigin(40, 16)
                               .SetModelBounds(-2, 6, -1, -4, 12, 1));
            RightArm = BuildBox(MakeBoxBounds(-2, -6, -2, 2, 6, 2)
                                .SetTexOrigin(40, 16)
                                .SetModelBounds(2, 6, -1, 4, 12, 1));
        }
コード例 #43
0
ファイル: IModel.cs プロジェクト: Cheesse/ClassicalSharp
 protected void XPlane( int texX, int texY, int texWidth, int texHeight,
     float z1, float z2, float y1, float y2, float x, bool _64x64)
 {
     vertices[index++] = new ModelVertex( x, y1, z1, texX, texY + texHeight );
     vertices[index++] = new ModelVertex( x, y2, z1, texX, texY );
     vertices[index++] = new ModelVertex( x, y2, z2, texX + texWidth, texY );
     vertices[index++] = new ModelVertex( x, y1, z2, texX + texWidth, texY + texHeight );
 }
コード例 #44
0
        protected void DrawRotate(float angleX, float angleY, float angleZ, ModelPart part, bool head, bool rotNormal)
        {
            float cosX = (float)Math.Cos(-angleX), sinX = (float)Math.Sin(-angleX);
            float cosY = (float)Math.Cos(-angleY), sinY = (float)Math.Sin(-angleY);
            float cosZ = (float)Math.Cos(-angleZ), sinZ = (float)Math.Sin(-angleZ);
            float x = part.RotX, y = part.RotY, z = part.RotZ;
            VertexP3fT2fC4bN1v vertex = default(VertexP3fT2fC4bN1v);

            VertexP3fT2fC4bN1v[] finVertices = game.ModelCache.vertices;

            for (int i = 0; i < part.Count; i++)
            {
                ModelVertex v = vertices[part.Offset + i];
                v.X -= x; v.Y -= y; v.Z -= z;
                float t = 0;

                // Rotate locally
                if (Rotate == RotateOrder.ZYX)
                {
                    t = cosZ * v.X + sinZ * v.Y; v.Y = -sinZ * v.X + cosZ * v.Y; v.X = t;                     // Inlined RotZ
                    t = cosY * v.X - sinY * v.Z; v.Z = sinY * v.X + cosY * v.Z; v.X = t;                      // Inlined RotY
                    t = cosX * v.Y + sinX * v.Z; v.Z = -sinX * v.Y + cosX * v.Z; v.Y = t;                     // Inlined RotX
                }
                else if (Rotate == RotateOrder.XZY)
                {
                    t = cosX * v.Y + sinX * v.Z; v.Z = -sinX * v.Y + cosX * v.Z; v.Y = t;                     // Inlined RotX
                    t = cosZ * v.X + sinZ * v.Y; v.Y = -sinZ * v.X + cosZ * v.Y; v.X = t;                     // Inlined RotZ
                    t = cosY * v.X - sinY * v.Z; v.Z = sinY * v.X + cosY * v.Z; v.X = t;                      // Inlined RotY
                }
                else if (Rotate == RotateOrder.YZX)
                {
                    t = cosY * v.X - sinY * v.Z; v.Z = sinY * v.X + cosY * v.Z; v.X = t;                      // Inlined RotY
                    t = cosZ * v.X + sinZ * v.Y; v.Y = -sinZ * v.X + cosZ * v.Y; v.X = t;                     // Inlined RotZ
                    t = cosX * v.Y + sinX * v.Z; v.Z = -sinX * v.Y + cosX * v.Z; v.Y = t;                     // Inlined RotX
                }

                // Rotate globally
                if (head)
                {
                    t = cosHead * v.X - sinHead * v.Z; v.Z = sinHead * v.X + cosHead * v.Z; v.X = t;                     // Inlined RotY
                }
                vertex.X      = v.X + x; vertex.Y = v.Y + y; vertex.Z = v.Z + z;
                vertex.Colour = cols[i >> 2];
                if (!v.N)
                {
                    vertex.Normal = v.D;
                }
                float normalAngleX = angleX;
                float normalAngleY = angleY;
                float normalAngleZ = angleZ;
                if (rotNormal)
                {
                    normalAngleX = angleX;
                    normalAngleY = angleY;
                    normalAngleZ = -angleZ;
                }
                if (Rotate == RotateOrder.ZYX)
                {
                    Vector3 newNormal = vertex.Normal;
                    newNormal     = Utils.RotateZ(newNormal, -normalAngleZ);
                    newNormal     = Utils.RotateY(newNormal, -normalAngleY);
                    newNormal     = Utils.RotateX(newNormal, -normalAngleX);
                    vertex.Normal = newNormal;
                }
                else if (Rotate == RotateOrder.XZY)
                {
                    Vector3 newNormal = vertex.Normal;
                    newNormal     = Utils.RotateX(newNormal, -normalAngleX);
                    newNormal     = Utils.RotateZ(newNormal, -normalAngleZ);
                    newNormal     = Utils.RotateY(newNormal, -normalAngleY);
                    vertex.Normal = newNormal;
                }
                else if (Rotate == RotateOrder.YZX)
                {
                    Vector3 newNormal = vertex.Normal;
                    newNormal     = Utils.RotateY(newNormal, -normalAngleY);
                    newNormal     = Utils.RotateZ(newNormal, -normalAngleZ);
                    newNormal     = Utils.RotateX(newNormal, -normalAngleX);
                    vertex.Normal = newNormal;
                }

                v.N = true;

                vertex.U             = (v.U & UVMask) * uScale - (v.U >> UVMaxShift) * 0.01f * uScale;
                vertex.V             = (v.V & UVMask) * vScale - (v.V >> UVMaxShift) * 0.01f * vScale;
                finVertices[index++] = vertex;
            }
        }
コード例 #45
0
 /// <inheritdoc/>
 public override void CreateParts()
 {
     vertices = new ModelVertex[boxVertices * 6 * 2];
     MakeBaseModel();
     MakeFurModel();
 }
コード例 #46
0
ファイル: IModel.cs プロジェクト: Cheesse/ClassicalSharp
 protected void YPlane( int texX, int texY, int texWidth, int texHeight,
     float x1, float x2, float z1, float z2, float y, bool _64x64)
 {
     vertices[index++] = new ModelVertex( x1, y, z2, texX, texY + texHeight );
     vertices[index++] = new ModelVertex( x1, y, z1, texX, texY );
     vertices[index++] = new ModelVertex( x2, y, z1, texX + texWidth, texY );
     vertices[index++] = new ModelVertex( x2, y, z2, texX + texWidth, texY + texHeight );
 }
コード例 #47
0
        protected void DrawRotated(float angleX, float angleY, float angleZ, ModelPart part, bool head)
        {
            float           cosX = (float)Math.Cos(-angleX), sinX = (float)Math.Sin(-angleX);
            float           cosY = (float)Math.Cos(-angleY), sinY = (float)Math.Sin(-angleY);
            float           cosZ = (float)Math.Cos(-angleZ), sinZ = (float)Math.Sin(-angleZ);
            float           x = part.RotX, y = part.RotY, z = part.RotZ;
            VertexP3fT2fC4b vertex = default(VertexP3fT2fC4b);

            for (int i = 0; i < part.Count; i++)
            {
                ModelVertex v = vertices[part.Offset + i];
                v.X -= x; v.Y -= y; v.Z -= z;
                float t = 0;

                // Rotate locally
                if (Rotate == RotateOrder.ZYX)
                {
                    t = cosZ * v.X + sinZ * v.Y; v.Y = -sinZ * v.X + cosZ * v.Y; v.X = t;                     // Inlined RotZ
                    t = cosY * v.X - sinY * v.Z; v.Z = sinY * v.X + cosY * v.Z; v.X = t;                      // Inlined RotY
                    t = cosX * v.Y + sinX * v.Z; v.Z = -sinX * v.Y + cosX * v.Z; v.Y = t;                     // Inlined RotX
                }
                else if (Rotate == RotateOrder.XZY)
                {
                    t = cosX * v.Y + sinX * v.Z; v.Z = -sinX * v.Y + cosX * v.Z; v.Y = t;                     // Inlined RotX
                    t = cosZ * v.X + sinZ * v.Y; v.Y = -sinZ * v.X + cosZ * v.Y; v.X = t;                     // Inlined RotZ
                    t = cosY * v.X - sinY * v.Z; v.Z = sinY * v.X + cosY * v.Z; v.X = t;                      // Inlined RotY
                }

                // Rotate globally
                if (!head)
                {
                    v.X += x; v.Y += y; v.Z += z;
                    t    = cosYaw * v.X - sinYaw * v.Z; v.Z = sinYaw * v.X + cosYaw * v.Z; v.X = t;                      // Inlined RotY
                }
                else
                {
                    t = cosHead * v.X - sinHead * v.Z; v.Z = sinHead * v.X + cosHead * v.Z; v.X = t;                     // Inlined RotY
                    float tX = x, tZ = z;
                    t    = cosYaw * tX - sinYaw * tZ; tZ = sinYaw * tX + cosYaw * tZ; tX = t;                            // Inlined RotY
                    v.X += tX; v.Y += y; v.Z += tZ;
                }
                v.X *= scale; v.Y *= scale; v.Z *= scale;
                v.X += pos.X; v.Y += pos.Y; v.Z += pos.Z;

                FastColour col = part.Count == boxVertices ?
                                 cols[i >> 2] : FastColour.Scale(this.col, 0.7f);
                vertex.X = v.X; vertex.Y = v.Y; vertex.Z = v.Z;
                vertex.R = col.R; vertex.G = col.G; vertex.B = col.B; vertex.A = 255;

                vertex.U = v.U * uScale; vertex.V = v.V * vScale;
                int quadI = i & 3;
                if (quadI == 0 || quadI == 3)
                {
                    vertex.V -= 0.01f * vScale;
                }
                if (quadI == 2 || quadI == 3)
                {
                    vertex.U -= 0.01f * vScale;
                }
                cache.vertices[index++] = vertex;
            }
        }
コード例 #48
0
ファイル: IModel.cs プロジェクト: Cheesse/ClassicalSharp
 protected void ZPlane( int texX, int texY, int texWidth, int texHeight,
     float x1, float x2, float y1, float y2, float z, bool _64x64)
 {
     vertices[index++] = new ModelVertex( x1, y1, z, texX, texY + texHeight );
     vertices[index++] = new ModelVertex( x1, y2, z, texX, texY );
     vertices[index++] = new ModelVertex( x2, y2, z, texX + texWidth, texY );
     vertices[index++] = new ModelVertex( x2, y1, z, texX + texWidth, texY + texHeight );
 }