Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 
#2

AW: Objekt zum Mittelpunkt routieren

  Alt 10. Aug 2016, 07:39
Hat sich erledigt...
Funktioniert nun wie es soll.

Delphi-Quellcode:
function RenderCompactDisc(This_Mod: PWinAMPVisModule): Integer;
Var
  Y: GLfloat;
  I: Integer;
  QuadAngle: single;
  aPos: TGLVectord3;
  SongLength_: Integer;
  SongPos_: Integer;

begin

  PlayState := SendMessage(This_Mod^.hWNDParent, WM_WA_IPC, 0, IPC_ISPLAYING);
  if PlayState <> 0 then
  begin
    SongLength_ := SendMessage(This_Mod^.hWNDParent, WM_USER, 1, IPC_GETOUTPUTTIME);
    SongPos_ := SendMessage(This_Mod^.hWNDParent, WM_WA_IPC, 0, IPC_GETOUTPUTTIME);

    if SongPos_ <> 0 then
      songpos := SongPos_
    else
      songpos := SendMessage(This_Mod^.hWNDParent, WM_WA_IPC, 0, IPC_GETOUTPUTTIME);

    if SongLength_ <> 0 then
      SongLength := SongLength_
    else
      SongLength := SendMessage(This_Mod^.hWNDParent, WM_USER, 1, IPC_GETOUTPUTTIME);
  end
  else
  begin
    rDisk := 0;
    Center.X := 0;
    Center.Y := 0;
    Center.Z := 0;
  end;

  if (songpos div 1000) < SongLength then
    inc(rDisk);

  BackGroundBeat := 0;
  for I := 0 to 9 do
    BackGroundBeat := BackGroundBeat + This_Mod^.spectrumData[0][I] + This_Mod^.spectrumData[1][I];

  BackGroundBeat := BackGroundBeat / 10 / 32;

  if BounceBeat then
    Y := BackGroundBeat
  else
    Y := 0;

  // Reset the matrix:
  glLoadIdentity;

  if ShowCover then
  begin
    for I := 0 to QuadCount - 1 do
    begin
      if not(LastAddCover = Round(NoCoverTexture)) then
        if LastAddCover = Trunc(quadTexture[I]) then
        begin
          if rDisk < 10 then
          begin
            aPos := Vector_Make3f(0, 0, 12);
            QuadAngle := DegToRad(360 / (QuadCount) * I) + ListAngle;
            aPos := Vector_Rotatef3(aPos, Vector_Make3f(0, 0, 0), QuadAngle, False, True, False);

            glTranslatef(0, -7, -30);
            // CD ist im Cover
            glTranslatef(aPos[0], aPos[1] + QuadSizeS, aPos[2] - 0.12)
          end
          else if (rDisk > 10) and (rDisk < 140) then
          begin
            //Bewege die CD in Y Richtung nach oben.
            aPos := Vector_Make3f(0, 0, 12);
            QuadAngle := DegToRad(360 / (QuadCount) * I) + ListAngle;
            aPos := Vector_Rotatef3(aPos, Vector_Make3f(0, 0, 0), QuadAngle, False, True, False);

            glTranslatef(0, -7, -30);
            AnimLblY := AnimLblY + 0.05;
            glTranslatef(aPos[0], (aPos[1] + QuadSizeS) + AnimLblY, aPos[2] - 0.12);
            Center.X := aPos[0];
            Center.Y := (aPos[1] + QuadSizeS) + AnimLblY;
            Center.Z := aPos[2] - 0.12;
          end
          else if (rDisk > 140) and (rDisk <= 360) then
          begin
            //Bewege die CD ins Zentrum.
            glTranslatef(0, -7, -30);
            if (Trunc(Center.X) > 0) then
              Center.X := Center.X - 0.1
            else if (Trunc(Center.X) < 0) then
              Center.X := Center.X + 0.1;

            if (Trunc(Center.Z) > 0) then
              Center.Z := Center.Z - 0.1
            else if (Trunc(Center.Z) < 0) then
              Center.Z := Center.Z + 0.1;

            aPos := Vector_Make3f(Center.X, Center.Y, Center.Z);
            QuadAngle := DegToRad(360 / (QuadCount) * I) + ListAngle;
            aPos := Vector_Rotatef3(aPos, Vector_Make3f(0, 0, 0), QuadAngle, True, True, True);

            glTranslatef(Center.X, Center.Y, Center.Z);
            glRotatef((rDisk - 180) * 0.8, 1, 0, 0);
            glRotatef((rDisk - 180) * 1, 0, 1, 0);
            glRotatef((rDisk - 180) * 0.1, 0, 0, 1);

          end
          else if rDisk > 360 then
          begin
            // CD ein wenig um die Achse drehen..
            if zoom < 14 then
              zoom := zoom + 0.2;

            glTranslatef(Center.X, 1.265, -34 + zoom);
            if rDisk > 540 then
            begin
              glRotatef((rDisk - 540) * 0.8, 1, 0, 0);
              glRotatef((rDisk - 540) * 1, 0, 1, 0);
              glRotatef((rDisk - 540) * 0.1, 0, 0, 1);
            end;
          end;

          glScalef(0.30, 0.30, 0.12);
          if zoom >= 14 then
          begin
            glTranslatef(Center.X, 1.265, -DiskPosition);
            glScalef(1.4, 1.4, 0.12);
            DrawDiscSpec(This_Mod);
          end;
          DrawCompactDisc;
        end;
    end;
  end
  else
  begin
    glTranslatef(0, 0, -DiskPosition + Y);

    if rDisk > 180 then
    begin
      glRotatef((rDisk - 180 + Y) * 0.8, 1, 0, 0);
      glRotatef((rDisk - 180 + Y) * 1, 0, 1, 0);
      glRotatef((rDisk - 180 + Y) * 0.1, 0, 0, 1);
    end;
    DrawDiscSpec(This_Mod);
    DrawCompactDisc;
  end;

  Result := 0;

end;
gruss

Geändert von EWeiss (10. Aug 2016 um 07:41 Uhr)
  Mit Zitat antworten Zitat