mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-23 04:34:58 -04:00
Forgot to port previous changes to C.
This commit is contained in:
parent
7ace31ee78
commit
345426107a
@ -197,10 +197,8 @@ namespace ClassicalSharp.Model {
|
||||
vertex.X = v.X; vertex.Y = v.Y; vertex.Z = v.Z;
|
||||
vertex.Colour = cols[i >> 2];
|
||||
|
||||
vertex.U = (v.U & UVMask) * uScale;
|
||||
vertex.U -= (v.U >> UVMaxShift) * 0.01f * uScale;
|
||||
vertex.V = (v.V & UVMask) * vScale;
|
||||
vertex.V -= (v.V >> UVMaxShift) * 0.01f * vScale;
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -236,10 +234,8 @@ namespace ClassicalSharp.Model {
|
||||
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;
|
||||
vertex.U -= (v.U >> UVMaxShift) * 0.01f * uScale;
|
||||
vertex.V = (v.V & UVMask) * vScale;
|
||||
vertex.V -= (v.V >> UVMaxShift) * 0.01f * vScale;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -90,11 +90,8 @@ void IModel_DrawPart(ModelPart part) {
|
||||
dst->X = v.X; dst->Y = v.Y; dst->Z = v.Z;
|
||||
dst->Colour = IModel_Cols[i >> 2];
|
||||
|
||||
dst->U = v.U * IModel_uScale; dst->V = v.V * IModel_vScale;
|
||||
Int32 quadI = i & 3;
|
||||
if (quadI == 0 || quadI == 3) dst->V -= 0.01f * IModel_vScale;
|
||||
if (quadI == 2 || quadI == 3) dst->U -= 0.01f * IModel_uScale;
|
||||
|
||||
dst->U = (v.U & IModel_UVMask) * IModel_uScale - (v.U >> IModel_UVMaxShift) * 0.01f * IModel_uScale;
|
||||
dst->V = (v.V & IModel_UVMask) * IModel_vScale - (v.V >> IModel_UVMaxShift) * 0.01f * IModel_vScale;
|
||||
dst++; model->index++;
|
||||
}
|
||||
}
|
||||
@ -131,11 +128,8 @@ void IModel_DrawRotate(Real32 angleX, Real32 angleY, Real32 angleZ, ModelPart pa
|
||||
dst->X = v.X + x; dst->Y = v.Y + y; dst->Z = v.Z + z;
|
||||
dst->Colour = IModel_Cols[i >> 2];
|
||||
|
||||
dst->U = v.U * IModel_uScale; dst->V = v.V * IModel_vScale;
|
||||
Int32 quadI = i & 3;
|
||||
if (quadI == 0 || quadI == 3) dst->V -= 0.01f * IModel_vScale;
|
||||
if (quadI == 2 || quadI == 3) dst->U -= 0.01f * IModel_uScale;
|
||||
|
||||
dst->U = (v.U & IModel_UVMask) * IModel_uScale - (v.U >> IModel_UVMaxShift) * 0.01f * IModel_uScale;
|
||||
dst->V = (v.V & IModel_UVMask) * IModel_vScale - (v.V >> IModel_UVMaxShift) * 0.01f * IModel_vScale;
|
||||
dst++; model->index++;
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,9 @@
|
||||
|
||||
#define IModel_QuadVertices 4
|
||||
#define IModel_BoxVertices (Face_Count * IModel_QuadVertices)
|
||||
#define IModel_UVMask ((UInt16)0x7FFF)
|
||||
#define IModel_UVMaxBit ((UInt16)0x8000)
|
||||
#define IModel_UVMaxShift 15
|
||||
|
||||
/* Order in which axis rotations are applied to a part. */
|
||||
typedef Int32 RotateOrder;
|
||||
|
@ -104,27 +104,28 @@ ModelPart BoxDesc_BuildRotatedBox(IModel* m, BoxDesc* desc) {
|
||||
}
|
||||
|
||||
|
||||
#define UV_MAX IModel_UVMaxBit
|
||||
void BoxDesc_XQuad(IModel* m, Int32 texX, Int32 texY, Int32 texWidth, Int32 texHeight,
|
||||
Real32 z1, Real32 z2, Real32 y1, Real32 y2, Real32 x) {
|
||||
ModelVertex_Init(&m->vertices[m->index], x, y1, z1, texX, texY + texHeight); m->index++;
|
||||
ModelVertex_Init(&m->vertices[m->index], x, y1, z1, texX, texY + texHeight | UV_MAX); m->index++;
|
||||
ModelVertex_Init(&m->vertices[m->index], x, y2, z1, texX, texY); m->index++;
|
||||
ModelVertex_Init(&m->vertices[m->index], x, y2, z2, texX + texWidth, texY); m->index++;
|
||||
ModelVertex_Init(&m->vertices[m->index], x, y1, z2, texX + texWidth, texY + texHeight); m->index++;
|
||||
ModelVertex_Init(&m->vertices[m->index], x, y2, z2, texX + texWidth | UV_MAX, texY); m->index++;
|
||||
ModelVertex_Init(&m->vertices[m->index], x, y1, z2, texX + texWidth | UV_MAX, texY + texHeight | UV_MAX); m->index++;
|
||||
}
|
||||
|
||||
void BoxDesc_YQuad(IModel* m, Int32 texX, Int32 texY, Int32 texWidth, Int32 texHeight,
|
||||
Real32 x1, Real32 x2, Real32 z1, Real32 z2, Real32 y) {
|
||||
ModelVertex_Init(&m->vertices[m->index], x1, y, z2, texX, texY + texHeight); m->index++;
|
||||
ModelVertex_Init(&m->vertices[m->index], x1, y, z2, texX, texY + texHeight | UV_MAX); m->index++;
|
||||
ModelVertex_Init(&m->vertices[m->index], x1, y, z1, texX, texY); m->index++;
|
||||
ModelVertex_Init(&m->vertices[m->index], x2, y, z1, texX + texWidth, texY); m->index++;
|
||||
ModelVertex_Init(&m->vertices[m->index], x2, y, z2, texX + texWidth, texY + texHeight); m->index++;
|
||||
ModelVertex_Init(&m->vertices[m->index], x2, y, z1, texX + texWidth | UV_MAX, texY); m->index++;
|
||||
ModelVertex_Init(&m->vertices[m->index], x2, y, z2, texX + texWidth | UV_MAX, texY + texHeight | UV_MAX); m->index++;
|
||||
}
|
||||
|
||||
void BoxDesc_ZQuad(IModel* m, Int32 texX, Int32 texY, Int32 texWidth, Int32 texHeight,
|
||||
Real32 x1, Real32 x2, Real32 y1, Real32 y2, Real32 z) {
|
||||
ModelVertex_Init(&m->vertices[m->index], x1, y1, z, texX, texY + texHeight); m->index++;
|
||||
ModelVertex_Init(&m->vertices[m->index], x1, y1, z, texX, texY + texHeight | UV_MAX); m->index++;
|
||||
ModelVertex_Init(&m->vertices[m->index], x1, y2, z, texX, texY); m->index++;
|
||||
ModelVertex_Init(&m->vertices[m->index], x2, y2, z, texX + texWidth, texY); m->index++;
|
||||
ModelVertex_Init(&m->vertices[m->index], x2, y1, z, texX + texWidth, texY + texHeight); m->index++;
|
||||
ModelVertex_Init(&m->vertices[m->index], x2, y2, z, texX + texWidth | UV_MAX, texY); m->index++;
|
||||
ModelVertex_Init(&m->vertices[m->index], x2, y1, z, texX + texWidth | UV_MAX, texY + texHeight | UV_MAX); m->index++;
|
||||
}
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user