physics.box2d.object: Add 'Z' component to 'Site' to allow small variations in 'Z' to prevent opengl from flipping visuals constantly due to all 'Z's being '0.0'.
This commit is contained in:
@@ -158,7 +158,7 @@ b2d_Object_Site (Object* Self)
|
|||||||
the_Site.y = Self->bodyDef.position (1);
|
the_Site.y = Self->bodyDef.position (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
the_Site.z = 0.0;
|
the_Site.z = 0.0;
|
||||||
|
|
||||||
return the_Site;
|
return the_Site;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -184,8 +184,9 @@ is
|
|||||||
overriding
|
overriding
|
||||||
function Site (Self : in Item) return Vector_3
|
function Site (Self : in Item) return Vector_3
|
||||||
is
|
is
|
||||||
the_Site : constant c_math_c.Vector_3.item := b2d_Object_Site (Self.C);
|
the_Site : c_math_c.Vector_3.item := b2d_Object_Site (Self.C);
|
||||||
begin
|
begin
|
||||||
|
the_Site.z := c_math_c.Real (Self.Site_z);
|
||||||
return +the_Site;
|
return +the_Site;
|
||||||
end Site;
|
end Site;
|
||||||
|
|
||||||
@@ -195,6 +196,7 @@ is
|
|||||||
is
|
is
|
||||||
c_Now : aliased c_math_c.Vector_3.item := +Now;
|
c_Now : aliased c_math_c.Vector_3.item := +Now;
|
||||||
begin
|
begin
|
||||||
|
Self.Site_z := Now (3);
|
||||||
b2d_Object_Site_is (Self.C, c_Now'unchecked_Access);
|
b2d_Object_Site_is (Self.C, c_Now'unchecked_Access);
|
||||||
end Site_is;
|
end Site_is;
|
||||||
|
|
||||||
@@ -238,8 +240,9 @@ is
|
|||||||
overriding
|
overriding
|
||||||
function Transform (Self : in Item) return Matrix_4x4
|
function Transform (Self : in Item) return Matrix_4x4
|
||||||
is
|
is
|
||||||
the_Transform : constant c_math_c.Matrix_4x4.item := b2d_Object_Transform (Self.C);
|
the_Transform : c_math_c.Matrix_4x4.item := b2d_Object_Transform (Self.C);
|
||||||
begin
|
begin
|
||||||
|
the_Transform.m32 := c_math_c.Real (Self.Site_z);
|
||||||
return +the_Transform;
|
return +the_Transform;
|
||||||
end Transform;
|
end Transform;
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ private
|
|||||||
user_Data : access lace.Any.limited_item'Class;
|
user_Data : access lace.Any.limited_item'Class;
|
||||||
|
|
||||||
Dynamics : physics.Object.safe_Dynamics;
|
Dynamics : physics.Object.safe_Dynamics;
|
||||||
|
Site_z : Real := 0.0;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user