unit perso;

interface

uses
  System.Collections,
  System.ComponentModel,
  System.Data,
  System.Drawing,
  System.Windows.Forms,
  System.IO,
  Microsoft.DirectX,
  Microsoft.DirectX.DirectInput,
  Microsoft.DirectX.Direct3D;

type
  TPos = record
    x, y, z, angle : real;
    saut, boost : boolean;
  end;

  TEventHandler      = System.EventHandler;
  TEventArgs         = System.EventArgs;
  TKeyEventArgs      = System.Windows.Forms.KeyEventArgs;
  TMouseEventArgs    = System.Windows.Forms.MouseEventArgs;
  TPaintEventArgs    = System.Windows.Forms.PaintEventArgs;
  TKeys              = System.Windows.Forms.Keys;
  TForm              = System.Windows.Forms.Form;
  TColor             = System.Drawing.Color;
  TIcon              = System.Drawing.Icon;



  TPerso = class
     public
      mesh : mesh; // le model
      materialarray : array of ExtendedMaterial;
      meshmaterials : array[0..0] of material;
      meshtextures : array[0..0] of texture;
      pos : TPos;
      constructor create;
      procedure initialize(device : device;meshName: string);
  end;

implementation

constructor TPerso.create;
begin
   inherited;
end;

procedure Tperso.initialize(device : device;meshName: string);
var
  vertices : vertexbuffer;
  stream : GraphicsStream;
begin

  mesh := Mesh.FromFile(meshName, MeshFlags.Managed, device, materialarray);

  meshmaterials[0] := materialarray[0].Material3D;
  meshmaterials[0].Ambient := meshmaterials[0].Diffuse;

  if ((materialarray[0].TextureFilename <> nil) and (materialarray[0].TextureFilename <> '')) then
    meshtextures[0] := TextureLoader.FromFile(device, materialarray[0].TextureFilename);

  mesh := mesh.Clone(mesh.Options.Value, CustomVertex.PositionNormalTextured.Format, device);
  mesh.ComputeNormals();
  vertices := mesh.VertexBuffer;
  stream := vertices.Lock(0, 0, LockFlags.None);

  vertices.Unlock();
end;





end.


