⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 oxnewtonstaticobjects.pas

📁 Newton Game Dynamic 1.52 Delphi下基于GLScene的OpenGL游戏开发控件。功能非常强大和易于使用。 Advanced physics engine for re
💻 PAS
📖 第 1 页 / 共 4 页
字号:
  if FActived or ( FManager = nil ) then Exit;
  BottomRadius:= TopRadius;
  FCollision:= NewtonCreateCylinder( FManager.World, TopRadius, Height, nil );
  FBody:= NewtonCreateBody( FManager.World, FCollision );
  if FManager.WorldMatrialCustom then begin
    FContactID:= FManager.WorldDefaultMaterialID;
    oxSetObjectMaterial( FBody );
  end;
  NewtonBodySetUserData( FBody, Self );
  oxPSetInitTransform( FBody, Self );
  NewtonReleaseCollision( FManager.World, FCollision );
  FManager.AddLog( 'Static Cylinder Name: '+Name, 1, ':Info Object' );
  FManager.AddLog(  Name + ' InitNewton.', 1, ':Info Object' );
  FActived:= True;
end;
{******************************************************************************}
// [15-9-2007]: TOXNewtonStaCylinder last change by Dave Gravel.             //
{******************************************************************************}
procedure TOXNewtonStaCylinder.DoProgress( const progressTime: TProgressTimes );
begin
  inherited;
  if FActived then begin
    if Assigned( FOnStepRender ) then
      FOnStepRender( progressTime.deltaTime, progressTime.newTime );
  end;
end;
{******************************************************************************}
// [15-9-2007]: TOXNewtonStaCylinder last change by Dave Gravel.             //
{******************************************************************************}
procedure TOXNewtonStaCylinder.BuildList( var rci: TRenderContextInfo );
begin
  if FOXVisual then
    oxStaCylinderBuildList( self, rci ) else
  exit;  
end;
{******************************************************************************}
// [15-9-2007]: TOXNewtonStaCylinder last change by Dave Gravel.             //
{******************************************************************************}
destructor TOXNewtonStaCylinder.Destroy;
begin
  if FActived and assigned( FBody ) then begin
    if ( not ( csDesigning in ComponentState ) ) then
      if Name = '' then FManager.AddLog( ClassName + ' destroyed.', 1, ':Info Object' )
      else FManager.AddLog( Name + ' destroyed.', 1, ':Info Object' );
    FActived:= False;
    NewtonDestroyBody( FManager.World, FBody );
  end;
  inherited destroy;
end;
{******************************************************************************}
// [15-9-2007]: TOXNewtonStaCCylinder last change by Dave Gravel.            //
{******************************************************************************}
constructor TOXNewtonStaCCylinder.Create( aOwner: TComponent );
begin
  inherited create( aOwner );
  FOrionX3D:= 100;
  FActived:= False;
  FMaterialCustom:= False;
  FOXVisual:= True;
  FContactID:= -1;
end;
{******************************************************************************}
// [15-9-2007]: TOXNewtonStaCCylinder last change by Dave Gravel.            //
{******************************************************************************}
procedure TOXNewtonStaCCylinder.Notification(AComponent: TComponent; Operation: TOperation);
begin
   inherited;
end;
{******************************************************************************}
// [15-9-2007]: TOXNewtonStaCCylinder last change by Dave Gravel.            //
{******************************************************************************}
procedure TOXNewtonStaCCylinder.UpdateTransformation;
begin
  if FActived then
    oxPSetInitTransform( FBody, Self );
end;
{******************************************************************************}
// [15-9-2007]: TOXNewtonStaCCylinder last change by Dave Gravel.            //
{******************************************************************************}
function TOXNewtonStaCCylinder.GetGeom: PNewtonCollision;
begin
  result:= FCollision;
end;
{******************************************************************************}
// [15-9-2007]: TOXNewtonStaCCylinder last change by Dave Gravel.            //
{******************************************************************************}
function TOXNewtonStaCCylinder.GetBody: PNewtonBody;
begin
  result:= FBody;
end;
{******************************************************************************}
// [15-9-2007]: TOXNewtonStaCCylinder last change by Dave Gravel.            //
{******************************************************************************}
function TOXNewtonStaCCylinder.GetCap1: TGLSphere;
begin
  if assigned( FCap1 ) then
    result := FCap1
  else result := nil;
end;
{******************************************************************************}
// [15-9-2007]: TOXNewtonStaCCylinder last change by Dave Gravel.            //
{******************************************************************************}
function TOXNewtonStaCCylinder.GetCap2: TGLSphere;
begin
  if assigned( FCap2 ) then 
    result := FCap2
  else result := nil;
end;
{******************************************************************************}
// [15-9-2007]: TOXNewtonStaCCylinder last change by Dave Gravel.            //
{******************************************************************************}
procedure TOXNewtonStaCCylinder.InitNewton;
begin
  FManager:= TOXNewtonManager(Scene);
  if FActived or ( FManager = nil ) then Exit;
  BottomRadius:= TopRadius;
  FCollision:= NewtonCreateCapsule( FManager.World,
  TopRadius, Height +
  TopRadius * 2, nil );
  FBody:= NewtonCreateBody( FManager.World, FCollision );
  if FManager.WorldMatrialCustom then begin
    FContactID:= FManager.WorldDefaultMaterialID;
    oxSetObjectMaterial( FBody );
  end;
  NewtonBodySetUserData( FBody, Self );
  oxPSetInitTransform( FBody, Self );
  NewtonReleaseCollision( FManager.World, FCollision );
  FCap1:= TGLSphere( AddNewChild( TGLSphere ) );
  FCap1.Material:= Material;
  FCap2:= TGLSphere( AddNewChild( TGLSphere ) );
  FCap2.Material:= Material;
  oxSetCapSCCylinder( FCap1, FCap2, self );
  FManager.AddLog( 'Static CCylinder Name: '+Name, 1, ':Info Object' );
  FManager.AddLog(  Name + ' InitNewton.', 1, ':Info Object' );
  FActived:= True;
end;
{******************************************************************************}
// [15-9-2007]: TOXNewtonStaCCylinder last change by Dave Gravel.            //
{******************************************************************************}
procedure TOXNewtonStaCCylinder.DoProgress( const progressTime: TProgressTimes );
begin
  inherited;
  if FActived then begin
    if Assigned( FOnStepRender ) then
      FOnStepRender( progressTime.deltaTime, progressTime.newTime );
  end;
end;
{******************************************************************************}
// [15-9-2007]: TOXNewtonStaCCylinder last change by Dave Gravel.            //
{******************************************************************************}
procedure TOXNewtonStaCCylinder.BuildList( var rci: TRenderContextInfo );
begin
  if FOXVisual then
    oxStaCCylinderBuildList( self, rci ) else
  exit;  
end;
{******************************************************************************}
// [15-9-2007]: TOXNewtonStaCCylinder last change by Dave Gravel.            //
{******************************************************************************}
destructor TOXNewtonStaCCylinder.Destroy;
begin
  if FActived and assigned( FBody ) then begin
    if ( not ( csDesigning in ComponentState ) ) then
      if Name = '' then FManager.AddLog( ClassName + ' destroyed.', 1, ':Info Object' )
      else FManager.AddLog( Name + ' destroyed.', 1, ':Info Object' );
    FActived:= False;
    NewtonDestroyBody( FManager.World, FBody );
  end;
  inherited destroy;
end;
{******************************************************************************}
// [15-9-2007]: TOXNewtonStaChamferCylinder last change by Dave Gravel.      //
{******************************************************************************}
constructor TOXNewtonStaChamferCylinder.Create( aOwner: TComponent );
begin
  inherited create( aOwner );
  FOrionX3D:= 100;
  FActived:= False;
  FMaterialCustom:= False;
  FOXVisual:= True;
  FContactID:= -1;
end;
{******************************************************************************}
// [15-9-2007]: TOXNewtonStaChamferCylinder last change by Dave Gravel.      //
{******************************************************************************}
procedure TOXNewtonStaChamferCylinder.Notification(AComponent: TComponent; Operation: TOperation);
begin
   inherited;
end;
{******************************************************************************}
// [15-9-2007]: TOXNewtonStaChamferCylinder last change by Dave Gravel.      //
{******************************************************************************}
procedure TOXNewtonStaChamferCylinder.UpdateTransformation;
begin
  if FActived then
    oxPSetInitTransform( FBody, Self );
end;
{******************************************************************************}
// [15-9-2007]: TOXNewtonStaChamferCylinder last change by Dave Gravel.      //
{******************************************************************************}
function TOXNewtonStaChamferCylinder.GetGeom: PNewtonCollision;
begin
  result:= FCollision;
end;
{******************************************************************************}
// [15-9-2007]: TOXNewtonStaChamferCylinder last change by Dave Gravel.      //
{******************************************************************************}
function TOXNewtonStaChamferCylinder.GetBody: PNewtonBody;
begin
  result:= FBody;
end;
{******************************************************************************}
// [15-9-2007]: TOXNewtonStaChamferCylinder last change by Dave Gravel.      //
{******************************************************************************}
procedure TOXNewtonStaChamferCylinder.InitNewton;
begin
  FManager:= TOXNewtonManager(Scene);
  if FActived or ( FManager = nil ) then Exit;
  FCollision:= NewtonCreateChamferCylinder( FManager.World,
  MajorRadius + MinorRadius,
  MinorRadius * 2, nil );
  FBody:= NewtonCreateBody( FManager.World, FCollision );
  if FManager.WorldMatrialCustom then begin
    FContactID:= FManager.WorldDefaultMaterialID;
    oxSetObjectMaterial( FBody );
  end;
  NewtonBodySetUserData( FBody, Self );
  oxPSetInitTransform( FBody, Self );
  NewtonReleaseCollision( FManager.World, FCollision );
  FManager.AddLog( 'Static ChamferCylinder Name: '+Name, 1, ':Info Object' );
  FManager.AddLog(  Name + ' InitNewton.', 1, ':Info Object' );
  FActived:= True;
end;
{******************************************************************************}
// [15-9-2007]: TOXNewtonStaChamferCylinder last change by Dave Gravel.      //
{******************************************************************************}
procedure TOXNewtonStaChamferCylinder.DoProgress( const progressTime: TProgressTimes );
begin
  inherited;
  if FActived then begin
    if Assigned( FOnStepRender ) then
      FOnStepRender( progressTime.deltaTime, progressTime.newTime );
  end;
end;
{******************************************************************************}
// [15-9-2007]: TOXNewtonStaChamferCylinder last change by Dave Gravel.      //
{******************************************************************************}
procedure TOXNewtonStaChamferCylinder.BuildList( var rci: TRenderContextInfo );
begin
  if FOXVisual then
    oxStaChamferCylinderBuildList( self, rci ) else
  exit;  
end;
{******************************************************************************}
// [15-9-2007]: TOXNewtonStaChamferCylinder last change by Dave Gravel.      //
{******************************************************************************}
destructor TOXNewtonStaChamferCylinder.Destroy;
begin
  if FActived and assigned( FBody ) then begin
    if ( not ( csDesigning in ComponentState ) ) then
      if Name = '' then FManager.AddLog( ClassName + ' destroyed.', 1, ':Info Object' )
      else FManager.AddLog( Name + ' destroyed.', 1, ':Info Object' );
    FActived:= False;
    NewtonDestroyBody( FManager.World, FBody );
  end;
  inherited destroy;
end;
{******************************************************************************}
// [15-9-2007]: TOXNewtonStaCone last change by Dave Gravel.                 //
{******************************************************************************}
constructor TOXNewtonStaCone.Create( aOwner: TComponent );
begin
  inherited create( aOwner );
  FOrionX3D:= 100;
  FActived:= False;
  FMaterialCustom:= False;
  FOXVisual:= True;
  FContactID:= -1;
end;
{******************************************************************************}
// [15-9-2007]: TOXNewtonStaCone last change by Dave Gravel.                 //

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -