This repository has been archived by the owner on Jul 30, 2018. It is now read-only.
forked from ddinan/more-models
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CowModel.cs
62 lines (45 loc) · 2.43 KB
/
CowModel.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
//using System;
using ClassicalSharp.Entities;
using ClassicalSharp.Physics;
using OpenTK;
namespace ClassicalSharp.Model {
public class CowModel : IModel {
public CowModel(Game game) : base(game) { SurivalScore = 10; }
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));
}
public override float NameYOffset { get { return 1.5f; } }
public override float GetEyeY(Entity entity) { return 12f/16f; }
public override Vector3 CollisionSize {
get { return new Vector3(14f / 16f, 14f / 16f, 14f / 16f); }
}
public override AABB PickingBounds {
get { return new AABB(-5f / 16f, 0f, -14f / 16f, 5f / 16f, 16f / 16f, 9f / 16f); }
}
public override void DrawModel(Entity p) {
game.Graphics.BindTexture(GetTexture(p));
DrawPart(torso);
DrawPart(udder);
DrawRotate(-p.HeadXRadians, 0f, 0f, head, true);
DrawRotate(-p.HeadXRadians, 0f, 0f, leftHorn, true);
DrawRotate(-p.HeadXRadians, 0f, 0f, rightHorn, true);
DrawRotate(p.anim.leftLegX, 0f, 0f, leftLegFront, false);
DrawRotate(p.anim.rightLegX, 0f, 0f, rightLegFront, false);
DrawRotate(p.anim.rightLegX, 0f, 0f, leftLegBack, false);
DrawRotate(p.anim.leftLegX, 0f, 0f, rightLegBack, false);
UpdateVB();
}
private ModelPart head, rightHorn, leftHorn, torso, udder, leftLegFront, rightLegFront, leftLegBack, rightLegBack;
private const int boxesBuilt = 9;
}
}