Autor Beitrag
AvadeX
Hält's aus hier
Beiträge: 10



BeitragVerfasst: Di 18.06.02 22:41 
Etwas lang, aber ein gutes Beispiel!
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
unit DX9A;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls,
  DXClass, DXDraws, DXInput, DirectX, DXQuad;  // DelphiX-Units

type
  TForm1 = class(TDXForm)
    DXDraw1: TDXDraw;
    DXTimer1: TDXTimer;
    DXImageList1: TDXImageList;
    DXInput1: TDXInput;
    Panel1: TPanel;
    Panel2: TPanel;
    procedure FormCreate(Sender: TObject);
    procedure DXDraw1InitializeSurface(Sender: TObject);
    procedure DXTimer1Timer(Sender: TObject; LagCount: Integer);
    procedure SetRange;
    procedure ShowQuad;
    procedure GetInput;
  private
    { Private-Deklarationen }
    Quader : TD3DPoly;
    Koords : TD3DKoords;
    Seite  : TD3DRect;
    Achse  : Integer;
    Textur : TDirect3DTexture2;
    TexZahl: Integer;
    xGrenze,
    zGrenze: TD3DValue;
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.SetRange;
begin
 // Wände als Grenzen setzen
 xGrenze := Koords.WorldMatrix._11 * 0.9;
 zGrenze := Koords.WorldMatrix._33 * 0.9;
end;

procedure TForm1.ShowQuad;
var i: Integer;
begin
  // Weltmatrix setzen
  DXDraw1.D3DDevice7.SetTransform
    (D3DTRANSFORMSTATE_WORLD, Koords.WorldMatrix);
  // Szene starten
  DXDraw1.D3DDevice7.BeginScene;
  // Quader aus Dreiecken zusammensetzen
  for i := 0 to 5 do
    DXDraw1.D3DDevice7.DrawPrimitive
      (D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX, Quader.Vertex[4*i+1], 40);
  // Szene beenden
  DXDraw1.D3DDevice7.EndScene;
end;

procedure TForm1.GetInput;
const xDiff=0.05; zDiff=0.5;
begin
  Achse := 0;
  with Koords do
  begin
    // Links/Rechts-Drehung
    if isLeft in DXInput1.States then
    begin
      TurnVector.y := TurnVector.y - xDiff; Achse := yAchse;
    end;
    if isRight in DXInput1.States then
    begin
      TurnVector.y := TurnVector.y + xDiff; Achse := yAchse;
    end;
    // Vor/Zurück-Bewegung mit Grenzkontrolle
    if isUp in Form1.DXInput1.States then
    begin
      if Abs(ViewVector.x) < xGrenze then
        ViewVector.x := ViewVector.x + zDiff * sin(TurnVector.y)
      else
        ViewVector.x := ViewVector.x * 0.99;
      if Abs(ViewVector.z) < zGrenze then
        ViewVector.z := ViewVector.z - zDiff * cos(TurnVector.y)
      else
        ViewVector.z := ViewVector.z * 0.99;
      Achse := zAchse;
    end;
    if isDown in Form1.DXInput1.States then
    begin
      if Abs(ViewVector.x) < xGrenze then
        ViewVector.x := ViewVector.x - zDiff * sin(TurnVector.y)
      else
        ViewVector.x := ViewVector.x * 0.99;
      if Abs(ViewVector.z) < zGrenze then
        ViewVector.z := ViewVector.z + zDiff * cos(TurnVector.y)
      else
        ViewVector.z := ViewVector.z * 0.99;
      Achse := zAchse;
    end;
    // Ende mit Esc (muss im Dialogfeld definiert sein!)
    if isButton3 in Form1.DXInput1.States then Close;
    // Kontrollanzeigen
    Panel1.Caption :=
      'ViewVector.x = '+FloatToStrF(ViewVector.x,ffNumber,8,4);
    Panel2.Caption :=
      'ViewVector.z = '+FloatToStrF(ViewVector.z,ffNumber,8,4);
    // Betrachterdaten setzen
    SetTurn2 (Achse, true);
  end;
  // Betrachtermatrix anwenden
  DXDraw1.D3DDevice7.SetTransform
    (D3DTRANSFORMSTATE_VIEW, Koords.ViewMatrix);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  randomize;
  // Quaderdaten initialisieren
  Quader := TD3DPoly.Create;
  Quader.isRoom := true;
  // Koordinatendaten setzen
  Koords := TD3DKoords.Create;
  Koords.LeftXRight.x := -1.0;
  Koords.SetScale (20.05.050.0);
  Koords.ViewVector.z := 0.0;
  Koords.SetView (0.0, true);
  SetRange;
  // Maße für Anzeigeseite festlegen
  Seite.x1 := 0; Seite.x2 := DXDraw1.SurfaceWidth;
  Seite.y1 := 0; Seite.y2 := DXDraw1.SurfaceHeight;
  // Anzahl der verfügbaren Texturen ermitteln
  TexZahl := DXImageList1.Items.Count;
end;

procedure TForm1.DXDraw1InitializeSurface(Sender: TObject);
var Material: TD3DMaterial7;
begin
  // Betrachtermatrix anwenden
  DXDraw1.D3DDevice7.SetTransform
    (D3DTRANSFORMSTATE_VIEW, Koords.ViewMatrix);
  // Projektionsmatrix anwenden
  DXDraw1.D3DDevice7.SetTransform
    (D3DTRANSFORMSTATE_PROJECTION, Koords.ProjectionMatrix);
  // Materialfarbe bestimmen
  FillChar (Material, SizeOf(Material), 0);
  with Material do
  begin
    ambient.r := 1.0;
    ambient.g := 1.0;
    ambient.b := 1.0;
  end;
  // Material "ansetzen"
  DXDraw1.D3DDevice7.SetMaterial (Material);
  DXDraw1.D3DDevice7.SetRenderState (D3DRENDERSTATE_AMBIENT, $ffffffff);
  // Textur holen und "ansetzen"
  Textur := TDirect3DTexture2.Create
    (DXDraw1, DXImageList1.Items[random(TexZahl)].Picture.Graphic, false);
  DXDraw1.D3DDevice7.SetTexture (0, Textur.Surface.IDDSurface7);
end;

procedure TForm1.DXTimer1Timer(Sender: TObject; LagCount: Integer);
begin
  if not DXDraw1.CanDraw then exit;
  DXInput1.Update;
  GetInput;
  // Anzeigeseite vor jedem Bewegungsschritt löschen
  if DXDraw1.ZBuffer <> nil then
    DXDraw1.D3DDevice7.Clear
      (1, Seite, D3DCLEAR_TARGET or D3DCLEAR_ZBUFFER, $00000010)
  else
    DXDraw1.D3DDevice7.Clear
      (1, Seite, D3DCLEAR_TARGET, $00000010);
  // Raum darstellen
  ShowQuad;
  // Surface anzeigen
  DXDraw1.Flip;
end;

end.

hier jetzt die DXQuad Unit:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
unit DXQuad;

interface
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, DirectX;

// Benötigte Ecken und Seiten pro Polygon (Quader) sowie Achsen
const EckZahl = 8; SeitenZahl = 6; VertexZahl = 24;
      xAchse = 1; yAchse = 2; zAchse = 3;

// Strukturen und Hilfsfunktionen für 3D-Vektoren und -Vertices
// -------------------------------------------------------------
// TD3DValue, TD3DVector, TD3DVertex, TD3DMatrix
// sind in der Unit DirectX vereinbart

function GetD3DVector (x, y, z: TD3DValue): TD3DVector;
function GetD3DVertex
         (Ecke, Seite: TD3DVector; texU, texV: TD3DValue): TD3DVertex;

type
  TD3DPoly = class
    QEck  : Array[1..EckZahl]    of TD3DVector;
    QSeite: Array[1..SeitenZahl] of TD3DVector;
    Vertex: Array[1..VertexZahl] of TD3DVertex;
    Tx    : Array[0..1of TD3DValue;
    isRoom: Boolean;
    constructor Create;
    procedure SetVectors;
    procedure SetVertices;
  end;

  TD3DKoords = class
    WorldMatrix,
    ViewMatrix,
    ProjectionMatrix: TD3DMatrix;
    ViewVector,
    TurnVector,
    LeftXRight,
    DownYUp,
    BackZFront: TD3DVector;
    constructor Create;
    procedure SetMatrices;
    procedure SetRotation (Achse: Integer);
    procedure SetScale (xMal, yMal, zMal: TD3DValue);
    procedure SetShift (xDiff, yDiff, zDiff: TD3DValue);
    procedure SetView (Winkel: TD3DValue; isRoom: Boolean);
    procedure SetView2;
    procedure SetTurn (Achse: Integer; isRoom: Boolean);
    procedure SetTurn2 (Achse: Integer; isRoom: Boolean);
  end;

implementation

function GetD3DVector(x, y, z: TD3DValue): TD3DVector;
begin
  Result.x := x;
  Result.y := y;
  Result.z := z;
end;

function GetD3DVertex
  (Ecke, Seite: TD3DVector; texU, texV: TD3DValue): TD3DVertex;
begin
  with Result do
  begin
    x  := Ecke.x; nx := Seite.x;
    y  := Ecke.y; ny := Seite.y;
    z  := Ecke.z; nz := Seite.z;
    tu := texU;   tv := texV;
  end;
end;

constructor TD3DPoly.Create;
begin
  //Texturkoordinaten
  Tx[0] := 0.0; Tx[1] := 1.0;
  // Vektoren und Vertices setzen
  SetVectors;
  SetVertices;
  // Quader ist Körper
  isRoom := false;
end;

procedure TD3DPoly.SetVectors;
begin
  // Normalwerte für Ecken
  QEck[1] := GetD3DVector (-1.01.0,-1.0);  // vorn   links  oben
  QEck[2] := GetD3DVector ( 1.01.0,-1.0);  // vorn   rechts oben
  QEck[3] := GetD3DVector ( 1.0,-1.0,-1.0);  // vorn   rechts unten
  QEck[4] := GetD3DVector (-1.0,-1.0,-1.0);  // vorn   links  unten
  QEck[5] := GetD3DVector (-1.01.01.0);  // hinten links  oben
  QEck[6] := GetD3DVector ( 1.01.01.0);  // hinten rechts oben
  QEck[7] := GetD3DVector ( 1.0,-1.01.0);  // hinten rechts unten
  QEck[8] := GetD3DVector (-1.0,-1.01.0);  // hinten links  unten
  // Normalwerte für Seiten (Faces)
  QSeite[1] := GetD3DVector ( 0.00.0,-1.0);  // vorn   (front)
  QSeite[2] := GetD3DVector ( 0.00.01.0);  // hinten (back)
  QSeite[3] := GetD3DVector (-1.00.00.0);  // links  (left)
  QSeite[4] := GetD3DVector ( 1.00.00.0);  // rechts (right)
  QSeite[5] := GetD3DVector ( 0.01.00.0);  // oben   (top)
  QSeite[6] := GetD3DVector ( 0.0,-1.00.0);  // unten  (bottom)
end;

procedure TD3DPoly.SetVertices;
begin
  // Vorderseite
  Vertex[1]  := GetD3DVertex (QEck[1], QSeite[1], Tx[0], Tx[0]);
  Vertex[2]  := GetD3DVertex (QEck[2], QSeite[1], Tx[0], Tx[1]);
  Vertex[3]  := GetD3DVertex (QEck[4], QSeite[1], Tx[1], Tx[0]);
  Vertex[4]  := GetD3DVertex (QEck[3], QSeite[1], Tx[1], Tx[1]);
  // Rückseite
  Vertex[5]  := GetD3DVertex (QEck[5], QSeite[2], Tx[0], Tx[0]);
  Vertex[6]  := GetD3DVertex (QEck[8], QSeite[2], Tx[0], Tx[1]);
  Vertex[7]  := GetD3DVertex (QEck[6], QSeite[2], Tx[1], Tx[0]);
  Vertex[8]  := GetD3DVertex (QEck[7], QSeite[2], Tx[1], Tx[1]);
  // Linke Seite
  Vertex[9]  := GetD3DVertex (QEck[1], QSeite[3], Tx[0], Tx[0]);
  Vertex[10] := GetD3DVertex (QEck[4], QSeite[3], Tx[0], Tx[1]);
  Vertex[11] := GetD3DVertex (QEck[5], QSeite[3], Tx[1], Tx[0]);
  Vertex[12] := GetD3DVertex (QEck[8], QSeite[3], Tx[1], Tx[1]);
  // Rechte Seite
  Vertex[13] := GetD3DVertex (QEck[2], QSeite[4], Tx[0], Tx[0]);
  Vertex[14] := GetD3DVertex (QEck[6], QSeite[4], Tx[0], Tx[1]);
  Vertex[15] := GetD3DVertex (QEck[3], QSeite[4], Tx[1], Tx[0]);
  Vertex[16] := GetD3DVertex (QEck[7], QSeite[4], Tx[1], Tx[1]);
  // Oberseite
  Vertex[17] := GetD3DVertex (QEck[5], QSeite[5], Tx[0], Tx[0]);
  Vertex[18] := GetD3DVertex (QEck[6], QSeite[5], Tx[0], Tx[1]);
  Vertex[19] := GetD3DVertex (QEck[1], QSeite[5], Tx[1], Tx[0]);
  Vertex[20] := GetD3DVertex (QEck[2], QSeite[5], Tx[1], Tx[1]);
  // Unterseite
  Vertex[21] := GetD3DVertex (QEck[8], QSeite[6], Tx[0], Tx[0]);
  Vertex[22] := GetD3DVertex (QEck[4], QSeite[6], Tx[0], Tx[1]);
  Vertex[23] := GetD3DVertex (QEck[7], QSeite[6], Tx[1], Tx[0]);
  Vertex[24] := GetD3DVertex (QEck[3], QSeite[6], Tx[1], Tx[1]);
end;

constructor TD3DKoords.Create;
begin
  SetMatrices;
  // Betrachtervektoren
  ViewVector := GetD3DVector (0.00.05.0);
  TurnVector := GetD3DVector (0.00.05.0);
  // Koordinatenkreuz
  LeftXRight := GetD3DVector (1.00.00.0);
  DownYUp    := GetD3DVector (0.01.00.0);
  BackZFront := GetD3DVector (0.00.01.0);
end;

procedure TD3DKoords.SetMatrices;
begin
  // Werte für Weltmatrix
  FillChar (WorldMatrix, SizeOf(WorldMatrix), 0);
  with WorldMatrix do
  begin
    _11 := 1.0; _22 := 1.0;
    _33 := 1.0; _44 := 1.0;
  end;
  // Werte für Viewmatrix
  FillChar (ViewMatrix, SizeOf(ViewMatrix), 0);
  with ViewMatrix do
  begin
    _11 := 1.0;
    _22 := 1.0; _23 := -0.5;
    _32 := 0.5; _33 :=  1.0;
    _43 := 5.0; _44 :=  1.0;
  end;
  // Werte für Projektionsmatrix
  FillChar (ProjectionMatrix, SizeOf(ProjectionMatrix), 0);
  with ProjectionMatrix do
  begin
    _11 :=  2.0;
    _22 :=  2.0;
    _33 :=  1.0; _34 := 1.0;
    _43 := -1.0;
  end;
end;

procedure TD3DKoords.SetRotation (Achse: Integer);
var Zeit: Extended; sinQ, cosQ: TD3DValue;
begin
  Zeit := GetTickCount/1000;
  // Drehrichtung bestimmen
  if Achse < 0 then
  begin Achse := -Achse; Zeit := -Zeit; end;
  // Winkelfunktionen
  sinQ := sin (Zeit); cosQ := cos (Zeit);
  // Werte für Weltmatrix
  FillChar (WorldMatrix, SizeOf(WorldMatrix), 0);
  with WorldMatrix do
  begin
    case Achse of
      xAchse: // Rotation um x-Achse
      begin
        _11 :=  1.0;
        _22 :=  cosQ; _23 := sinQ;
        _32 := -sinQ; _33 := cosQ;
        _44 :=  1.0;
      end;
      yAchse: // Rotation um y-Achse
      begin
        _11 :=  cosQ; _13 := -sinQ;
        _22 :=  1.0;
        _31 :=  sinQ; _33 :=  cosQ;
        _44 :=  1.0;
      end;
      zAchse: // Rotation um z-Achse
      begin
        _11 :=  cosQ; _12 := sinQ;
        _21 := -sinQ; _22 := cosQ;
        _33 :=  1.0;
        _44 :=  1.0;
      end
      else // Einheitsmatrix
      begin
        _11 := 1.0; _22 := 1.0;
        _33 := 1.0; _44 := 1.0;
      end;
    end;
  end;
end;

procedure TD3DKoords.SetScale (xMal, yMal, zMal: TD3DValue);
begin
  // Weltkoordinaten skalieren
  with WorldMatrix do
  begin
    _11 := _11 * xMal;
    _22 := _22 * yMal;
    _33 := _33 * zMal;
  end;
end;

procedure TD3DKoords.SetShift (xDiff, yDiff, zDiff: TD3DValue);
begin
  // Weltkoordinaten verschieben
  with WorldMatrix do
  begin
    _41 := _41 + xDiff;
    _42 := _42 + yDiff;
    _43 := _43 + zDiff;
  end;
end;

procedure TD3DKoords.SetView (Winkel: TD3DValue; isRoom: Boolean);
begin
  with ViewMatrix do
  begin
    // Körper oder Raum?
    if isRoom then _11 := -1.0 else _11 := 1.0;
    // Sichtwinkel von vorn (oben +/unten -)
    _22 :=  cos(Winkel*Pi/180);
    _23 := -sin(Winkel*Pi/180);
    _32 :=  sin(Winkel*Pi/180);
    _33 :=  cos(Winkel*Pi/180);
    // Verschiebungen
    _41 := ViewVector.x;  // rechts oder links
    _42 := ViewVector.y;  // rauf oder runter
    _43 := ViewVector.z;  // vor oder zurück
  end;
end;

procedure TD3DKoords.SetTurn (Achse: Integer; isRoom: Boolean);
begin
  with ViewMatrix do
  begin
    case Achse of
      yAchse: // Drehung nach links/rechts
      begin
        // Körper oder Raum?
        if isRoom then
        begin
          _11 := -cos(TurnVector.y);
          _31 := -sin(TurnVector.y);
        end
        else
        begin
          _11 :=  cos(TurnVector.y);
          _31 :=  sin(TurnVector.y);
        end;
        _13 := -sin(TurnVector.y);
        _33 :=  cos(TurnVector.y);
      end;
      zAchse: // Verschiebung vor/zurück
        _43 := ViewVector.z;
    end;
  end;
end;

procedure TD3DKoords.SetView2;
begin
  with ViewMatrix do
  begin
    _11 := LeftXRight.x; _12 := DownYUp.x; _13 := BackZFront.x;
    _21 := LeftXRight.y; _22 := DownYUp.y; _23 := BackZFront.y;
    _31 := LeftXRight.z; _32 := DownYUp.z; _33 := BackZFront.z;
    // Punktprodukte für Betrachterkoordinaten
    _41 := VectorDotProduct (ViewVector, LeftXRight);
    _42 := VectorDotProduct (ViewVector, DownYUp);
    _43 := VectorDotProduct (ViewVector, BackZFront);
  end;
end;

procedure TD3DKoords.SetTurn2 (Achse: Integer; isRoom: Boolean);
begin
  case Achse of
    xAchse: // Rotation um x-Achse
    begin
      //DownYUp.y    :=  cos(TurnVector.x);
      //DownYUp.z    := -sin(TurnVector.x);
      //BackZFront.y :=  sin(TurnVector.x);
      //BackZFront.z :=  cos(TurnVector.x);
    end;
    yAchse: // Rotation um y-Achse
    begin
      // Körper oder Raum?
      if isRoom then
      begin
        LeftXRight.x := -cos(TurnVector.y);
        LeftXRight.z := -sin(TurnVector.y);
      end
      else
      begin
        LeftXRight.x :=  cos(TurnVector.y);
        LeftXRight.z :=  sin(TurnVector.y);
      end;
      BackZFront.x := -sin(TurnVector.y);
      BackZFront.z :=  cos(TurnVector.y);
    end;
    zAchse: // Rotation um z-Achse
    begin
      //isRoom beachten!
      //LeftXRight.x :=  cos(TurnVector.z);
      //LeftXRight.y := -sin(TurnVector.z);
      //DownYUp.x    :=  sin(TurnVector.z);
      //DownYUp.y    :=  cos(TurnVector.z);
    end;
  end;
  // Matrixwerte anpassen
  SetView2;
end;

end.