Beispiel #1
0
 /// <summary>
 /// tool function to pass color in shader as one float parameter. Reduces quality to 10^3 colors
 /// </summary>
 /// <param name="Color"></param>
 /// <returns></returns>
 private float ToFloat(MiniGameInterfaces.Color Color)
 {
     return (float)((Math.Round(Color.r*0.94f, 1) +
         Math.Round(Color.g * 0.94f, 1) * 10 + Math.Round(Color.b * 0.94f, 1) * 100 + Math.Round(Color.a * 0.94f, 1) * 1000));
 }
Beispiel #2
0
 public void DrawRectangle(MiniGameInterfaces.Rectangle Rectangle, MiniGameInterfaces.Color Color)
 {
     if (CRectanglesInBatch < MaxBatchSize / 2)
      {
         DebugRectangleBatchParams1[CRectanglesInBatch].X = Rectangle.Center.X;
         DebugRectangleBatchParams1[CRectanglesInBatch].Y = Rectangle.Center.Y;
         DebugRectangleBatchParams1[CRectanglesInBatch].Z = Rectangle.Size.X;
         DebugRectangleBatchParams1[CRectanglesInBatch].W = Rectangle.Size.Y;
         DebugRectangleBatchParams2[CRectanglesInBatch].X = Rectangle.Angle;
         DebugRectangleBatchParams2[CRectanglesInBatch].Y = 0;//is rectangle
         DebugRectangleBatchParams2[CRectanglesInBatch].Z = 0;//reserved
         DebugRectangleBatchParams2[CRectanglesInBatch].W =ToFloat(Color);
         CRectanglesInBatch++;
     }
 }
Beispiel #3
0
 public void DrawLine(Line Line,MiniGameInterfaces.Color Color)
 {
     if (CRectanglesInBatch < MaxBatchSize / 2)
     {
         MiniGameInterfaces.Rectangle rect=new MiniGameInterfaces.Rectangle((Line.pt1+Line.pt2)*0.5f,
             new GameVector(Line.Length(),0.003f*CameraPosition.Z),Line.pt2-Line.pt1);
         DrawRectangle(rect, Color);
     }
 }
Beispiel #4
0
 public void DrawPoint(GameVector Vector, MiniGameInterfaces.Color Color)
 {
     if (CRectanglesInBatch < MaxBatchSize / 2)
     {
         DebugRectangleBatchParams1[CRectanglesInBatch].X = Vector.X;
         DebugRectangleBatchParams1[CRectanglesInBatch].Y = Vector.Y;
         DebugRectangleBatchParams1[CRectanglesInBatch].Z = 0.01f*CameraPosition.Z;
         DebugRectangleBatchParams1[CRectanglesInBatch].W = 0.01f * CameraPosition.Z;
         DebugRectangleBatchParams2[CRectanglesInBatch].X = 0;
         DebugRectangleBatchParams2[CRectanglesInBatch].Y = 1;//is circle
         DebugRectangleBatchParams2[CRectanglesInBatch].Z = 0;//reserved
         DebugRectangleBatchParams2[CRectanglesInBatch].W = ToFloat(Color);
         CRectanglesInBatch++;
     }
 }
Beispiel #5
0
 public void DrawCircle(Circle Circle, MiniGameInterfaces.Color Color)
 {
     if (CRectanglesInBatch < MaxBatchSize / 2)
     {
         DebugRectangleBatchParams1[CRectanglesInBatch].X = Circle.Center.X;
         DebugRectangleBatchParams1[CRectanglesInBatch].Y = Circle.Center.Y;
         DebugRectangleBatchParams1[CRectanglesInBatch].Z = Circle.Radius*2;
         DebugRectangleBatchParams1[CRectanglesInBatch].W = Circle.Radius * 2;
         DebugRectangleBatchParams2[CRectanglesInBatch].X = 0;
         DebugRectangleBatchParams2[CRectanglesInBatch].Y = 1;//is circle
         DebugRectangleBatchParams2[CRectanglesInBatch].Z = 0;//reserved
         DebugRectangleBatchParams2[CRectanglesInBatch].W = ToFloat(Color);
         CRectanglesInBatch++;
     }
 }