@@ -163,7 +163,7 @@ TEST_P(AiksTest, CanRenderTiledTexture) {
163
163
contents->SetTexture (texture);
164
164
contents->SetTileModes (x_tile_mode, y_tile_mode);
165
165
contents->SetSamplerDescriptor (descriptor);
166
- contents->SetMatrix (matrix);
166
+ contents->SetEffectTransform (matrix);
167
167
return contents;
168
168
};
169
169
paint.color = Color (1 , 1 , 1 , alpha);
@@ -347,7 +347,7 @@ TEST_P(AiksTest, CanRenderLinearGradient) {
347
347
contents->SetColors (std::move (colors));
348
348
contents->SetStops (std::move (stops));
349
349
contents->SetTileMode (tile_mode);
350
- contents->SetMatrix (matrix);
350
+ contents->SetEffectTransform (matrix);
351
351
return contents;
352
352
};
353
353
paint.color = Color (1.0 , 1.0 , 1.0 , alpha);
@@ -412,7 +412,7 @@ TEST_P(AiksTest, CanRenderLinearGradientManyColors) {
412
412
contents->SetColors (std::move (colors));
413
413
contents->SetStops (std::move (stops));
414
414
contents->SetTileMode (tile_mode);
415
- contents->SetMatrix (matrix);
415
+ contents->SetEffectTransform (matrix);
416
416
return contents;
417
417
};
418
418
paint.color = Color (1.0 , 1.0 , 1.0 , alpha);
@@ -468,7 +468,7 @@ TEST_P(AiksTest, CanRenderLinearGradientWayManyColors) {
468
468
contents->SetColors (colors);
469
469
contents->SetStops (stops);
470
470
contents->SetTileMode (tile_mode);
471
- contents->SetMatrix (matrix);
471
+ contents->SetEffectTransform (matrix);
472
472
return contents;
473
473
};
474
474
canvas.DrawRect ({0 , 0 , 600 , 600 }, paint);
@@ -525,7 +525,7 @@ TEST_P(AiksTest, CanRenderLinearGradientManyColorsUnevenStops) {
525
525
contents->SetColors (std::move (colors));
526
526
contents->SetStops (std::move (stops));
527
527
contents->SetTileMode (tile_mode);
528
- contents->SetMatrix (matrix);
528
+ contents->SetEffectTransform (matrix);
529
529
return contents;
530
530
};
531
531
canvas.DrawRect ({0 , 0 , 600 , 600 }, paint);
@@ -573,7 +573,7 @@ TEST_P(AiksTest, CanRenderRadialGradient) {
573
573
contents->SetColors (std::move (colors));
574
574
contents->SetStops (std::move (stops));
575
575
contents->SetTileMode (tile_mode);
576
- contents->SetMatrix (matrix);
576
+ contents->SetEffectTransform (matrix);
577
577
return contents;
578
578
};
579
579
canvas.DrawRect ({0 , 0 , 600 , 600 }, paint);
@@ -635,7 +635,7 @@ TEST_P(AiksTest, CanRenderRadialGradientManyColors) {
635
635
contents->SetColors (std::move (colors));
636
636
contents->SetStops (std::move (stops));
637
637
contents->SetTileMode (tile_mode);
638
- contents->SetMatrix (matrix);
638
+ contents->SetEffectTransform (matrix);
639
639
return contents;
640
640
};
641
641
canvas.DrawRect ({0 , 0 , 600 , 600 }, paint);
@@ -682,7 +682,7 @@ TEST_P(AiksTest, CanRenderSweepGradient) {
682
682
contents->SetColors (std::move (colors));
683
683
contents->SetStops (std::move (stops));
684
684
contents->SetTileMode (tile_mode);
685
- contents->SetMatrix (matrix);
685
+ contents->SetEffectTransform (matrix);
686
686
return contents;
687
687
};
688
688
canvas.DrawRect ({0 , 0 , 600 , 600 }, paint);
@@ -744,7 +744,7 @@ TEST_P(AiksTest, CanRenderSweepGradientManyColors) {
744
744
contents->SetStops (std::move (stops));
745
745
contents->SetColors (std::move (colors));
746
746
contents->SetTileMode (tile_mode);
747
- contents->SetMatrix (matrix);
747
+ contents->SetEffectTransform (matrix);
748
748
return contents;
749
749
};
750
750
canvas.DrawRect ({0 , 0 , 600 , 600 }, paint);
@@ -1509,7 +1509,7 @@ TEST_P(AiksTest, GradientStrokesRenderCorrectly) {
1509
1509
contents->SetColors (std::move (colors));
1510
1510
contents->SetStops (std::move (stops));
1511
1511
contents->SetTileMode (tile_mode);
1512
- contents->SetMatrix (matrix);
1512
+ contents->SetEffectTransform (matrix);
1513
1513
return contents;
1514
1514
};
1515
1515
@@ -1718,21 +1718,30 @@ TEST_P(AiksTest, SceneColorSource) {
1718
1718
auto callback = [&](AiksContext& renderer, RenderTarget& render_target) {
1719
1719
Paint paint;
1720
1720
1721
+ ImGui::Begin (" Controls" , nullptr , ImGuiWindowFlags_AlwaysAutoResize);
1722
+ static Scalar distance = 2 ;
1723
+ ImGui::SliderFloat (" Distance" , &distance, 0 , 4 );
1724
+ static Scalar y_pos = 0 ;
1725
+ ImGui::SliderFloat (" Y" , &y_pos, -3 , 3 );
1726
+ static Scalar fov = 45 ;
1727
+ ImGui::SliderFloat (" FOV" , &fov, 1 , 180 );
1728
+ ImGui::End ();
1729
+
1721
1730
paint.color_source_type = Paint::ColorSourceType::kScene ;
1722
- paint.color_source = [this , gltf_scene ]() {
1731
+ paint.color_source = [& ]() {
1723
1732
Scalar angle = GetSecondsElapsed ();
1724
- Scalar distance = 2 ;
1725
- auto camera_position =
1726
- Vector3 (distance * std::sin (angle), 2 , -distance * std::cos (angle));
1733
+ auto camera_position = Vector3 (distance * std::sin (angle), y_pos,
1734
+ -distance * std::cos (angle));
1727
1735
auto contents = std::make_shared<SceneContents>();
1728
1736
contents->SetNode (gltf_scene);
1729
1737
contents->SetCameraTransform (
1730
- Matrix::MakePerspective (Degrees (45 ), GetWindowSize (), 0.1 , 1000 ) *
1738
+ Matrix::MakePerspective (Degrees (fov ), GetWindowSize (), 0.1 , 1000 ) *
1731
1739
Matrix::MakeLookAt (camera_position, {0 , 0 , 0 }, {0 , 1 , 0 }));
1732
1740
return contents;
1733
1741
};
1734
1742
1735
1743
Canvas canvas;
1744
+ canvas.DrawPaint (Paint{.color = Color::MakeRGBA8 (0xf9 , 0xf9 , 0xf9 , 0xff )});
1736
1745
canvas.Scale (GetContentScale ());
1737
1746
canvas.DrawPaint (paint);
1738
1747
return renderer.Render (canvas.EndRecordingAsPicture (), render_target);
0 commit comments