@@ -29,12 +29,9 @@ public async Task FlushAllAsyncBakesSingleSourceUnitIntoSingleMaterialAndSubmesh
2929 Assert . Single ( cityObject . Mesh . Submeshes ) ;
3030 Assert . Equal ( 6 , cityObject . Mesh . Vertices . Count ) ;
3131 Assert . Equal ( "unit-a.gml" , cityObject . SourceFileRelativePath ) ;
32- ResoniteTexturePayload atlasPayload = Assert . IsType < ResoniteTexturePayload > ( cityObject . Materials [ 0 ] . TexturePayload ) ;
33- Assert . Equal ( ResoniteTexturePayloadFormat . RawRgba32 , atlasPayload . Format ) ;
34- Assert . NotNull ( atlasPayload . Width ) ;
35- Assert . NotNull ( atlasPayload . Height ) ;
36- Assert . InRange ( atlasPayload . Width ! . Value , 1 , 32 ) ;
37- Assert . InRange ( atlasPayload . Height ! . Value , 1 , 32 ) ;
32+ RawRgba32ResoniteTexturePayload atlasPayload = Assert . IsType < RawRgba32ResoniteTexturePayload > ( cityObject . Materials [ 0 ] . TexturePayload ) ;
33+ Assert . InRange ( atlasPayload . Width , 1 , 32 ) ;
34+ Assert . InRange ( atlasPayload . Height , 1 , 32 ) ;
3835 Assert . Equal ( CommonMaterialCatalog . Create ( ) . Generic . Uv , cityObject . Materials [ 0 ] . CommonMaterial ) ;
3936 }
4037
@@ -63,8 +60,7 @@ await AssertBufferedAsync(baker, CreateUvScaledLod2Building(
6360 new ResoniteFloat2 ( 0.5 , 0.0 ) ) ) ;
6461
6562 ResoniteConstructionCityObject cityObject = Assert . Single ( await baker . FlushAllAsync ( ) ) ;
66- ResoniteTexturePayload atlasPayload = Assert . IsType < ResoniteTexturePayload > ( cityObject . Materials [ 0 ] . TexturePayload ) ;
67- Assert . Equal ( ResoniteTexturePayloadFormat . RawRgba32 , atlasPayload . Format ) ;
63+ RawRgba32ResoniteTexturePayload atlasPayload = Assert . IsType < RawRgba32ResoniteTexturePayload > ( cityObject . Materials [ 0 ] . TexturePayload ) ;
6864 Assert . Equal ( 1 , atlasPayload . Width ) ;
6965 Assert . Equal ( 1 , atlasPayload . Height ) ;
7066 Assert . Null ( cityObject . Materials [ 0 ] . TextureScale ) ;
@@ -152,7 +148,7 @@ await AssertBufferedAsync(
152148 Assert . NotSame ( payload , material . TexturePayload ) ;
153149 Assert . NotNull ( material . TexturePayload ) ;
154150 Assert . Contains ( "atlastex-" , material . TexturePayload . Identity , StringComparison . Ordinal ) ;
155- Assert . Equal ( ResoniteTexturePayloadFormat . RawRgba32 , material . TexturePayload . Format ) ;
151+ Assert . IsType < RawRgba32ResoniteTexturePayload > ( material . TexturePayload ) ;
156152 Assert . Null ( material . TextureScale ) ;
157153 Assert . Null ( material . TextureOffset ) ;
158154 }
@@ -212,7 +208,7 @@ await AssertBufferedAsync(baker, CreateUvScaledLod2Building(
212208 new ResoniteFloat2 ( 0.0 , 0.0 ) ) ) ;
213209
214210 ResoniteConstructionCityObject cityObject = Assert . Single ( await baker . FlushAllAsync ( ) ) ;
215- ResoniteTexturePayload atlasPayload = Assert . IsType < ResoniteTexturePayload > ( Assert . Single ( cityObject . Materials ) . TexturePayload ) ;
211+ RawRgba32ResoniteTexturePayload atlasPayload = Assert . IsType < RawRgba32ResoniteTexturePayload > ( Assert . Single ( cityObject . Materials ) . TexturePayload ) ;
216212
217213 Assert . Equal ( 2 , atlasPayload . Width ) ;
218214 Assert . Equal ( 1 , atlasPayload . Height ) ;
@@ -261,8 +257,7 @@ await AssertBufferedAsync(baker, CreateUvScaledLod2Building(
261257 null ) ) ;
262258
263259 ResoniteConstructionCityObject cityObject = Assert . Single ( await baker . FlushAllAsync ( ) ) ;
264- ResoniteTexturePayload atlasPayload = Assert . IsType < ResoniteTexturePayload > ( cityObject . Materials [ 0 ] . TexturePayload ) ;
265- Assert . Equal ( ResoniteTexturePayloadFormat . RawRgba32 , atlasPayload . Format ) ;
260+ RawRgba32ResoniteTexturePayload atlasPayload = Assert . IsType < RawRgba32ResoniteTexturePayload > ( cityObject . Materials [ 0 ] . TexturePayload ) ;
266261 Assert . Equal ( 4 , atlasPayload . Width ) ;
267262 Assert . Equal ( 1 , atlasPayload . Height ) ;
268263 Assert . Equal ( new Rgba32 ( 255 , 0 , 0 , 255 ) , ReadPixel ( atlasPayload , 0 , 0 ) ) ;
@@ -285,7 +280,7 @@ await AssertBufferedAsync(baker, CreateUvScaledLod2Building(
285280
286281 ResoniteConstructionCityObject cityObject = Assert . Single ( await baker . FlushAllAsync ( ) ) ;
287282 ResoniteMaterialBinding material = Assert . Single ( cityObject . Materials ) ;
288- ResoniteTexturePayload atlasPayload = Assert . IsType < ResoniteTexturePayload > ( material . TexturePayload ) ;
283+ RawRgba32ResoniteTexturePayload atlasPayload = Assert . IsType < RawRgba32ResoniteTexturePayload > ( material . TexturePayload ) ;
289284
290285 Assert . Null ( material . TextureScale ) ;
291286 Assert . Null ( material . TextureOffset ) ;
@@ -325,7 +320,7 @@ await AssertBufferedAsync(
325320 "unit-a" ) ) ;
326321
327322 ResoniteConstructionCityObject cityObject = Assert . Single ( await baker . FlushAllAsync ( ) ) ;
328- ResoniteTexturePayload atlasPayload = Assert . IsType < ResoniteTexturePayload > ( cityObject . Materials [ 0 ] . TexturePayload ) ;
323+ RawRgba32ResoniteTexturePayload atlasPayload = Assert . IsType < RawRgba32ResoniteTexturePayload > ( cityObject . Materials [ 0 ] . TexturePayload ) ;
329324
330325 Assert . Equal ( 2 , atlasPayload . Width ) ;
331326 Assert . Equal ( 1 , atlasPayload . Height ) ;
@@ -778,7 +773,7 @@ public async Task FlushAllAsyncPacksMixedSizeTexturesIntoSingleAtlasBatch()
778773 await AssertBufferedAsync ( baker , CreateLod2Building ( "building-c" , CreateCheckerPayload ( "textures/c.png" , new Rgba32 ( 0 , 0 , 255 , 255 ) , new Rgba32 ( 255 , 0 , 255 , 255 ) , 3 , 3 ) , 4 , "unit-a" ) ) ;
779774
780775 ResoniteConstructionCityObject cityObject = Assert . Single ( await baker . FlushAllAsync ( ) ) ;
781- ResoniteTexturePayload atlasPayload = Assert . IsType < ResoniteTexturePayload > ( cityObject . Materials [ 0 ] . TexturePayload ) ;
776+ RawRgba32ResoniteTexturePayload atlasPayload = Assert . IsType < RawRgba32ResoniteTexturePayload > ( cityObject . Materials [ 0 ] . TexturePayload ) ;
782777 Assert . Equal ( 16 , atlasPayload . Width ) ;
783778 Assert . Equal ( 8 , atlasPayload . Height ) ;
784779 }
@@ -968,7 +963,7 @@ await AssertBufferedAsync(
968963 "unit-a" ) ) ;
969964
970965 ResoniteConstructionCityObject cityObject = Assert . Single ( await baker . FlushAllAsync ( ) ) ;
971- ResoniteTexturePayload atlasPayload = Assert . IsType < ResoniteTexturePayload > ( cityObject . Materials [ 0 ] . TexturePayload ) ;
966+ RawRgba32ResoniteTexturePayload atlasPayload = Assert . IsType < RawRgba32ResoniteTexturePayload > ( cityObject . Materials [ 0 ] . TexturePayload ) ;
972967 Assert . Equal ( 512 , atlasPayload . Width ) ;
973968 Assert . Equal ( 512 , atlasPayload . Height ) ;
974969 }
@@ -1061,7 +1056,7 @@ await AssertBufferedAsync(
10611056 Assert . Equal ( "atlasbake-unit-a-bldg-lod2-3" , cityObject . SlotKey ) ;
10621057 Assert . Equal (
10631058 "atlastex-unit-a.gml-3" ,
1064- Assert . IsType < ResoniteTexturePayload > ( Assert . Single ( cityObject . Materials ) . TexturePayload ) . Identity ) ;
1059+ Assert . IsType < RawRgba32ResoniteTexturePayload > ( Assert . Single ( cityObject . Materials ) . TexturePayload ) . Identity ) ;
10651060 }
10661061
10671062 private static NonDemCityObjectBaker CreateBaker (
@@ -1146,11 +1141,9 @@ private static ResoniteTexturePayload CreateVerticalSplitPayload(string identity
11461141 return ResoniteTextureImportFactory . CreatePayloadFromImage ( image , identity : identity ) ;
11471142 }
11481143
1149- private static Rgba32 ReadPixel ( ResoniteTexturePayload payload , int x , int y )
1144+ private static Rgba32 ReadPixel ( RawRgba32ResoniteTexturePayload payload , int x , int y )
11501145 {
1151- Assert . Equal ( ResoniteTexturePayloadFormat . RawRgba32 , payload . Format ) ;
1152- Assert . NotNull ( payload . Width ) ;
1153- int width = payload . Width . Value ;
1146+ int width = payload . Width ;
11541147 int offset = ( ( y * width ) + x ) * 4 ;
11551148 ReadOnlySpan < byte > bytes = payload . BinaryPayload . AsSpan ( ) ;
11561149 return new Rgba32 (
0 commit comments