Save 'simple arms anim' as an option, start work on supporting non 0 min/1 max cubes.

This commit is contained in:
UnknownShadow200 2015-12-20 23:28:35 +11:00
parent a094406585
commit aaea397140
6 changed files with 40 additions and 32 deletions

View file

@ -15,9 +15,10 @@ namespace ClassicalSharp {
buttons = new ButtonWidget[] {
// Column 1
Make( -140, -150, "Use simple arms", OnWidgetClick,
g => g.SimpleArmsAnim ? "yes" : "no",
(g, v) => g.SimpleArmsAnim = v == "yes"),
Make( -140, -150, "Simple arms anim", OnWidgetClick,
g => g.SimpleArmsAnim? "yes" : "no",
(g, v) => { g.SimpleArmsAnim = v == "yes";
Options.Set( OptionsKey.SimpleArmsAnim, v == "yes" ); }),
Make( -140, -100, "Use sound", OnWidgetClick,
g => g.UseSound ? "yes" : "no",

View file

@ -49,9 +49,8 @@ namespace ClassicalSharp {
legXRot = -(float)(Math.Cos( walkTime ) * swing * legMax);
armZRot = -idleZRot;
bobYOffset = (float)(Math.Abs( Math.Cos( walkTime ) ) * swing * (2/16f));
tilt = (float)Math.Cos( walkTime ) * swing * (0.15f * Utils.Deg2Rad);
bobYOffset = (float)(Math.Abs( Math.Cos( walkTime ) ) * swing * (3/16f));
tilt = (float)Math.Cos( walkTime ) * swing * (0.15f * Utils.Deg2Rad);
if( Model is PlayerModel )
CalcHumanAnim( idleXRot, idleZRot );
}

View file

@ -104,7 +104,7 @@ namespace ClassicalSharp {
public bool ShowAxisLines;
/// <summary> Whether players should animate using simple swinging parallel to their bodies. </summary>
public bool SimpleArmsAnim = true;
public bool SimpleArmsAnim = false;
public long Vertices;
public FrustumCulling Culling;

View file

@ -1,6 +1,7 @@
//#define DEBUG_OCCLUSION
using System;
using ClassicalSharp.GraphicsAPI;
using OpenTK;
namespace ClassicalSharp {
@ -9,6 +10,7 @@ namespace ClassicalSharp {
public partial class ChunkMeshBuilder {
int X, Y, Z;
float x1, y1, z1, x2, y2, z2;
byte tile;
BlockInfo info;
Map map;
@ -119,7 +121,7 @@ namespace ClassicalSharp {
public void RenderTile( int chunkIndex, int xx, int yy, int zz, int x, int y, int z ) {
X = x; Y = y; Z = z;
int index = ( ( yy << 8 ) + ( zz << 4 ) + xx ) * TileSide.Sides;
int index = ((yy << 8) | (zz << 4) | xx) * TileSide.Sides;
if( info.IsSprite[tile] ) {
fullBright = info.FullBright[tile];
@ -137,6 +139,11 @@ namespace ClassicalSharp {
if( leftCount == 0 && rightCount == 0 && frontCount == 0 &&
backCount == 0 && bottomCount == 0 && topCount == 0 ) return;
Vector3 min = info.MinBB[tile];
Vector3 max = info.MaxBB[tile];
x1 = x + min.X; y1 = y + min.Y; z1 = z + min.Z;
x2 = x + max.X; y2 = y + max.Y; z2 = z + max.Z;
fullBright = info.FullBright[tile];
blockHeight = info.Height[tile];
isTranslucent = info.IsTranslucent[tile];

View file

@ -174,10 +174,10 @@ namespace ClassicalSharp {
}
DrawInfo part = isTranslucent ? drawInfoTranslucent[i] : drawInfoNormal[i];
part.vertices[part.vIndex.left++] = new VertexPos3fTex2fCol4b( X, Y + blockHeight, Z + count, rec.U2, rec.V1, col );
part.vertices[part.vIndex.left++] = new VertexPos3fTex2fCol4b( X, Y + blockHeight, Z, rec.U1, rec.V1, col );
part.vertices[part.vIndex.left++] = new VertexPos3fTex2fCol4b( X, Y, Z, rec.U1, rec.V2, col );
part.vertices[part.vIndex.left++] = new VertexPos3fTex2fCol4b( X, Y, Z + count, rec.U2, rec.V2, col );
part.vertices[part.vIndex.left++] = new VertexPos3fTex2fCol4b( x1, y2, z1 + count, rec.U2, rec.V1, col );
part.vertices[part.vIndex.left++] = new VertexPos3fTex2fCol4b( x1, y2, z1, rec.U1, rec.V1, col );
part.vertices[part.vIndex.left++] = new VertexPos3fTex2fCol4b( x1, y1, z1, rec.U1, rec.V2, col );
part.vertices[part.vIndex.left++] = new VertexPos3fTex2fCol4b( x1, y1, z1 + count, rec.U2, rec.V2, col );
}
void DrawRightFace( int count ) {
@ -191,10 +191,10 @@ namespace ClassicalSharp {
}
DrawInfo part = isTranslucent ? drawInfoTranslucent[i] : drawInfoNormal[i];
part.vertices[part.vIndex.right++] = new VertexPos3fTex2fCol4b( X + 1, Y + blockHeight, Z, rec.U2, rec.V1, col );
part.vertices[part.vIndex.right++] = new VertexPos3fTex2fCol4b( X + 1, Y + blockHeight, Z + count, rec.U1, rec.V1, col );
part.vertices[part.vIndex.right++] = new VertexPos3fTex2fCol4b( X + 1, Y, Z + count, rec.U1, rec.V2, col );
part.vertices[part.vIndex.right++] = new VertexPos3fTex2fCol4b( X + 1, Y, Z, rec.U2, rec.V2, col );
part.vertices[part.vIndex.right++] = new VertexPos3fTex2fCol4b( x2, y2, z1, rec.U2, rec.V1, col );
part.vertices[part.vIndex.right++] = new VertexPos3fTex2fCol4b( x2, y2, z1 + count, rec.U1, rec.V1, col );
part.vertices[part.vIndex.right++] = new VertexPos3fTex2fCol4b( x2, y1, z1 + count, rec.U1, rec.V2, col );
part.vertices[part.vIndex.right++] = new VertexPos3fTex2fCol4b( x2, y1, z1, rec.U2, rec.V2, col );
}
void DrawBackFace( int count ) {
@ -208,10 +208,10 @@ namespace ClassicalSharp {
}
DrawInfo part = isTranslucent ? drawInfoTranslucent[i] : drawInfoNormal[i];
part.vertices[part.vIndex.back++] = new VertexPos3fTex2fCol4b( X + count, Y + blockHeight, Z + 1, rec.U2, rec.V1, col );
part.vertices[part.vIndex.back++] = new VertexPos3fTex2fCol4b( X, Y + blockHeight, Z + 1, rec.U1, rec.V1, col );
part.vertices[part.vIndex.back++] = new VertexPos3fTex2fCol4b( X, Y, Z + 1, rec.U1, rec.V2, col );
part.vertices[part.vIndex.back++] = new VertexPos3fTex2fCol4b( X + count, Y, Z + 1, rec.U2, rec.V2, col );
part.vertices[part.vIndex.back++] = new VertexPos3fTex2fCol4b( x1 + count, y2, z2, rec.U2, rec.V1, col );
part.vertices[part.vIndex.back++] = new VertexPos3fTex2fCol4b( x1, y2, z2, rec.U1, rec.V1, col );
part.vertices[part.vIndex.back++] = new VertexPos3fTex2fCol4b( x1, y1, z2, rec.U1, rec.V2, col );
part.vertices[part.vIndex.back++] = new VertexPos3fTex2fCol4b( x1 + count, y1, z2, rec.U2, rec.V2, col );
}
void DrawFrontFace( int count ) {
@ -225,10 +225,10 @@ namespace ClassicalSharp {
}
DrawInfo part = isTranslucent ? drawInfoTranslucent[i] : drawInfoNormal[i];
part.vertices[part.vIndex.front++] = new VertexPos3fTex2fCol4b( X + count, Y, Z, rec.U1, rec.V2, col );
part.vertices[part.vIndex.front++] = new VertexPos3fTex2fCol4b( X, Y, Z, rec.U2, rec.V2, col );
part.vertices[part.vIndex.front++] = new VertexPos3fTex2fCol4b( X, Y + blockHeight, Z, rec.U2, rec.V1, col );
part.vertices[part.vIndex.front++] = new VertexPos3fTex2fCol4b( X + count, Y + blockHeight, Z, rec.U1, rec.V1, col );
part.vertices[part.vIndex.front++] = new VertexPos3fTex2fCol4b( x1 + count, y1, z1, rec.U1, rec.V2, col );
part.vertices[part.vIndex.front++] = new VertexPos3fTex2fCol4b( x1, y1, z1, rec.U2, rec.V2, col );
part.vertices[part.vIndex.front++] = new VertexPos3fTex2fCol4b( x1, y2, z1, rec.U2, rec.V1, col );
part.vertices[part.vIndex.front++] = new VertexPos3fTex2fCol4b( x1 + count, y2, z1, rec.U1, rec.V1, col );
}
void DrawBottomFace( int count ) {
@ -238,10 +238,10 @@ namespace ClassicalSharp {
FastColour col = fullBright ? FastColour.White : ((Y - 1) > map.heightmap[(Z * width) + X] ? map.SunlightYBottom : map.ShadowlightYBottom);
DrawInfo part = isTranslucent ? drawInfoTranslucent[i] : drawInfoNormal[i];
part.vertices[part.vIndex.bottom++] = new VertexPos3fTex2fCol4b( X + count, Y, Z + 1, rec.U2, rec.V2, col );
part.vertices[part.vIndex.bottom++] = new VertexPos3fTex2fCol4b( X, Y, Z + 1, rec.U1, rec.V2, col );
part.vertices[part.vIndex.bottom++] = new VertexPos3fTex2fCol4b( X, Y, Z, rec.U1, rec.V1, col );
part.vertices[part.vIndex.bottom++] = new VertexPos3fTex2fCol4b( X + count, Y, Z, rec.U2, rec.V1, col );
part.vertices[part.vIndex.bottom++] = new VertexPos3fTex2fCol4b( x1 + count, y1, z2, rec.U2, rec.V2, col );
part.vertices[part.vIndex.bottom++] = new VertexPos3fTex2fCol4b( x1, y1, z2, rec.U1, rec.V2, col );
part.vertices[part.vIndex.bottom++] = new VertexPos3fTex2fCol4b( x1, y1, z1, rec.U1, rec.V1, col );
part.vertices[part.vIndex.bottom++] = new VertexPos3fTex2fCol4b( x1 + count, y1, z1, rec.U2, rec.V1, col );
}
void DrawTopFace( int count ) {
@ -251,10 +251,10 @@ namespace ClassicalSharp {
FastColour col = fullBright ? FastColour.White : (Y > map.heightmap[(Z * width) + X] ? map.Sunlight : map.Shadowlight);
DrawInfo part = isTranslucent ? drawInfoTranslucent[i] : drawInfoNormal[i];
part.vertices[part.vIndex.top++] = new VertexPos3fTex2fCol4b( X + count, Y + blockHeight, Z, rec.U2, rec.V1, col );
part.vertices[part.vIndex.top++] = new VertexPos3fTex2fCol4b( X, Y + blockHeight, Z, rec.U1, rec.V1, col );
part.vertices[part.vIndex.top++] = new VertexPos3fTex2fCol4b( X, Y + blockHeight, Z + 1, rec.U1, rec.V2, col );
part.vertices[part.vIndex.top++] = new VertexPos3fTex2fCol4b( X + count, Y + blockHeight, Z + 1, rec.U2, rec.V2, col );
part.vertices[part.vIndex.top++] = new VertexPos3fTex2fCol4b( x1 + count, y2, z1, rec.U2, rec.V1, col );
part.vertices[part.vIndex.top++] = new VertexPos3fTex2fCol4b( x1, y2, z1, rec.U1, rec.V1, col );
part.vertices[part.vIndex.top++] = new VertexPos3fTex2fCol4b( x1, y2, z2, rec.U1, rec.V2, col );
part.vertices[part.vIndex.top++] = new VertexPos3fTex2fCol4b( x1 + count, y2, z2, rec.U2, rec.V2, col );
}
void DrawSprite( int count ) {

View file

@ -22,6 +22,7 @@ namespace ClassicalSharp {
public const string UseSound = "usesound";
public const string HacksEnabled = "hacksenabled";
public const string NamesMode = "namesmode";
public const string SimpleArmsAnim = "simplearmsanim";
public const string MouseLeft = "mouseleft";
public const string MouseMiddle = "mousemiddle";