mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 19:45:23 -04:00
Scale before rotation for models
This commit is contained in:
parent
8c7e047268
commit
4d23053559
@ -90,15 +90,15 @@ namespace ClassicalSharp.Entities {
|
||||
|
||||
public Matrix4 TransformMatrix(Vector3 scale, Vector3 pos) {
|
||||
Matrix4 m = Matrix4.Identity, tmp;
|
||||
|
||||
|
||||
Matrix4.Scale(out tmp, scale.X, scale.Y, scale.Z);
|
||||
Matrix4.Mult(out m, ref m, ref tmp);
|
||||
Matrix4.RotateZ(out tmp, -RotZ * Utils.Deg2Rad);
|
||||
Matrix4.Mult(out m, ref m, ref tmp);
|
||||
Matrix4.RotateX(out tmp, -RotX * Utils.Deg2Rad);
|
||||
Matrix4.Mult(out m, ref m, ref tmp);
|
||||
Matrix4.RotateY(out tmp, -RotY * Utils.Deg2Rad);
|
||||
Matrix4.Mult(out m, ref m, ref tmp);
|
||||
Matrix4.Scale(out tmp, scale.X, scale.Y, scale.Z);
|
||||
Matrix4.Mult(out m, ref m, ref tmp);
|
||||
Matrix4.Translate(out tmp, pos.X, pos.Y, pos.Z);
|
||||
Matrix4.Mult(out m, ref m, ref tmp);
|
||||
|
||||
@ -226,6 +226,8 @@ namespace ClassicalSharp.Entities {
|
||||
/// bounding box of this entity are water or still water. </summary>
|
||||
public bool TouchesAnyWater() {
|
||||
AABB bounds = Bounds.Offset(liqExpand);
|
||||
bounds.Min.Y += 5f/16f;
|
||||
bounds.Max.Y -= 5f/16f;
|
||||
return TouchesAny(bounds, touchesAnyWater);
|
||||
}
|
||||
static Predicate<BlockID> touchesAnyWater = IsWater;
|
||||
|
@ -64,14 +64,14 @@ void Entity_GetTransform(Entity* entity, Vector3 pos, Vector3 scale) {
|
||||
*m = Matrix_Identity;
|
||||
Matrix tmp;
|
||||
|
||||
Matrix_Scale(&tmp, scale.X, scale.Y, scale.Z);
|
||||
Matrix_MulBy(m, &tmp);
|
||||
Matrix_RotateZ(&tmp, -entity->RotZ * MATH_DEG2RAD);
|
||||
Matrix_MulBy(m, &tmp);
|
||||
Matrix_RotateX(&tmp, -entity->RotX * MATH_DEG2RAD);
|
||||
Matrix_MulBy(m, &tmp);
|
||||
Matrix_RotateY(&tmp, -entity->RotY * MATH_DEG2RAD);
|
||||
Matrix_MulBy(m, &tmp);
|
||||
Matrix_Scale(&tmp, scale.X, scale.Y, scale.Z);
|
||||
Matrix_MulBy(m, &tmp);
|
||||
Matrix_Translate(&tmp, pos.X, pos.Y, pos.Z);
|
||||
Matrix_MulBy(m, &tmp);
|
||||
/* return rotZ * rotX * rotY * scale * translate; */
|
||||
|
Loading…
x
Reference in New Issue
Block a user