mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 10:05:44 -04:00
Fix bug with StringBuffer/UnsafeString being drawn way too wide on some Windows versions, fixes #46. (Thanks Cheesse)
This commit is contained in:
parent
4371246f96
commit
ad18567f69
@ -44,11 +44,10 @@ namespace ClassicalSharp {
|
||||
Vector3 pos = Position;
|
||||
pos.Y += Model.NameYOffset;
|
||||
|
||||
// Inlined translation + rotation Y axis
|
||||
api.texVerts[0] = new VertexPos3fTex2f( cosA * x1 + pos.X, y1 + pos.Y, sinA * x1 + pos.Z, nameTex.U1, nameTex.V1 );
|
||||
api.texVerts[1] = new VertexPos3fTex2f( cosA * x2 + pos.X, y1 + pos.Y, sinA * x2 + pos.Z, nameTex.U2, nameTex.V1 );
|
||||
api.texVerts[2] = new VertexPos3fTex2f( cosA * x2 + pos.X, y2 + pos.Y, sinA * x2 + pos.Z, nameTex.U2, nameTex.V2 );
|
||||
api.texVerts[3] = new VertexPos3fTex2f( cosA * x1 + pos.X, y2 + pos.Y, sinA * x1 + pos.Z, nameTex.U1, nameTex.V2 );
|
||||
api.texVerts[0] = new VertexPos3fTex2f( Utils.RotateY( x1, y1, 0, pos, cosA, sinA ), nameTex.U1, nameTex.V1 );
|
||||
api.texVerts[1] = new VertexPos3fTex2f( Utils.RotateY( x2, y1, 0, pos, cosA, sinA ), nameTex.U2, nameTex.V1 );
|
||||
api.texVerts[2] = new VertexPos3fTex2f( Utils.RotateY( x2, y2, 0, pos, cosA, sinA ), nameTex.U2, nameTex.V2 );
|
||||
api.texVerts[3] = new VertexPos3fTex2f( Utils.RotateY( x1, y2, 0, pos, cosA, sinA ), nameTex.U1, nameTex.V2 );
|
||||
|
||||
api.BeginVbBatch( VertexFormat.Pos3fTex2f );
|
||||
api.DrawDynamicIndexedVb( DrawMode.Triangles, api.texVb, api.texVerts, 4, 6 );
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using ClassicalSharp.GraphicsAPI;
|
||||
using ClassicalSharp.Renderers;
|
||||
using OpenTK;
|
||||
|
||||
namespace ClassicalSharp.Model {
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using ClassicalSharp.GraphicsAPI;
|
||||
using ClassicalSharp.Renderers;
|
||||
using OpenTK;
|
||||
|
||||
namespace ClassicalSharp.Model {
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using ClassicalSharp.GraphicsAPI;
|
||||
using ClassicalSharp.Renderers;
|
||||
using OpenTK;
|
||||
|
||||
namespace ClassicalSharp.Model {
|
||||
|
@ -11,7 +11,7 @@ namespace ClassicalSharp.Model {
|
||||
protected IGraphicsApi graphics;
|
||||
protected const int planeVertices = 4;
|
||||
protected const int partVertices = 6 * planeVertices;
|
||||
|
||||
|
||||
public IModel( Game window ) {
|
||||
this.window = window;
|
||||
graphics = window.Graphics;
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using ClassicalSharp.GraphicsAPI;
|
||||
using ClassicalSharp.Renderers;
|
||||
using OpenTK;
|
||||
|
||||
namespace ClassicalSharp.Model {
|
||||
|
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using ClassicalSharp.GraphicsAPI;
|
||||
using ClassicalSharp.Renderers;
|
||||
using OpenTK;
|
||||
|
||||
namespace ClassicalSharp.Model {
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using ClassicalSharp.GraphicsAPI;
|
||||
using ClassicalSharp.Renderers;
|
||||
using OpenTK;
|
||||
|
||||
namespace ClassicalSharp.Model {
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using ClassicalSharp.GraphicsAPI;
|
||||
using ClassicalSharp.Renderers;
|
||||
using OpenTK;
|
||||
|
||||
namespace ClassicalSharp.Model {
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using ClassicalSharp.GraphicsAPI;
|
||||
using ClassicalSharp.Renderers;
|
||||
using OpenTK;
|
||||
|
||||
namespace ClassicalSharp.Model {
|
||||
|
@ -144,7 +144,7 @@ namespace ClassicalSharp {
|
||||
/// <returns> The underlying string - ***do not*** store this because it is mutable!
|
||||
/// You should only use this string for temporary measuring and drawing. </returns>
|
||||
public string UpdateCachedString() {
|
||||
return supportsLengthSetting ? value : value.TrimEnd( trimEnd );
|
||||
return supportsLengthSetting ? SetLength( Length ) : value.TrimEnd( trimEnd );
|
||||
}
|
||||
static char[] trimEnd = { '\0' };
|
||||
|
||||
|
@ -128,6 +128,10 @@ namespace ClassicalSharp {
|
||||
return new Vector3( cosA * x - sinA * z, y, sinA * x + cosA * z );
|
||||
}
|
||||
|
||||
public static Vector3 RotateY( float x, float y, float z, Vector3 translate, float cosA, float sinA ) {
|
||||
return new Vector3( cosA * x - sinA * z + translate.X, y + translate.Y, sinA * x + cosA * z + translate.Z );
|
||||
}
|
||||
|
||||
public static float DistanceSquared( Vector3 p1, Vector3 p2 ) {
|
||||
float dx = p2.X - p1.X;
|
||||
float dy = p2.Y - p1.Y;
|
||||
|
Loading…
x
Reference in New Issue
Block a user