Moderators: Sascha Willems, walaber
Sascha Willems wrote:I was recently contacted by Dominique Loius, who maintains the SDL-translations to Pascal if I could do some Newton demos to include with the official JEDI-SDL release. Without wasting a second I agreed and ported all the developer demos that were on my page to use SDL, so they can be compiled under all OS'es that are supported by Pascal+Newton+SDL (which in the end are Win32, Linux and MacOS). So you'll now find all the developer demos on that page are using SDL and moreover I also updated all the demos to use accumulative time-slicing, so they are now all framerate-independent. Right now you can't use them with Linux, as there is only a static library for Linux included in the current SDK. But Julio already told me that there will be a dynamic Library for Linux in the next release (1.35).
var
LBaseJoint: TRPBaseJoint;
Begin
LBaseJoint := NewtonJointGetUserData(aJoint); TRPBaseJoint = Class(TObject)
protected
FMaxDOF: Integer;
FBody0: PNewtonBody;
FBody1: PNewtonBody;
FJoint: PNewtonJoint;
FWorld: PNewtonWorld;
public
constructor Create(aMaxDOF: Integer; aBody0, aBody1: PNewtonBody);
destructor Destroy;
procedure CalculateGlobalMatrix(const aLocalMatrix0, aLocalMatrix1: TMatrix; out aMatrix0, aMatrix1: TMatrix);
procedure CalculateLocalMatrix(const aPivot, aDir: TAffineVector; out aLocalMatrix0, aLocalMatrix1: TMatrix);
procedure SubmitConstraint; virtual; abstract;
end;
TRPJointUpVector = Class(TRPBaseJoint)
private
FLocalMatrix0: TMatrix;
FLocalMatrix1: TMatrix;
public
constructor Create(aPin: TAffineVector; aBody: PNewtonBody);
procedure SetPinDir(const aDir: TAffineVector);
procedure SubmitConstraint; override;
end;
function SubmitJointConstraint(const aJoint: PNewtonJoint): Cardinal;
var
LBaseJoint: TRPBaseJoint;
Begin
LBaseJoint := NewtonJointGetUserData(aJoint);
if LBaseJoint <> nil then
LBaseJoint.SubmitConstraint;
end;
constructor TRPBaseJoint.Create(aMaxDOF: Integer; aBody0, aBody1: PNewtonBody);
Begin
FBody0 := aBody0;
FBody1 := aBody1;
FMaxDOF := aMaxDOF;
FWorld := NewtonBodyGetWorld(aBody0);
FJoint := NewtonConstraintCreateUserJoint(FWorld, FMaxDOF, @SubmitJointConstraint, FBody0, FBody1);
NewtonJointSetUserData(FJoint, Self);
NewtonJointSetDestructor(FJoint, @JointDestructor);
end;
var
LJoint: TRPBaseJoint;
LJoint := TRPJointUpVector.Create(aPin, aParent);
Users browsing this forum: No registered users and 1 guest