@@ -187,7 +187,7 @@ core::smart_refctd_ptr<ICPUPolygonGeometry> CGeometryCreator::createCube(const h
187
187
snorm_normal_t * normals;
188
188
189
189
using uv_element_t = uint8_t ;
190
- constexpr auto MaxUvVal = std::numeric_limits<uv_element_t >::max ();
190
+ constexpr auto UnityUV = std::numeric_limits<uv_element_t >::max ();
191
191
hlsl::vector<uv_element_t ,2 >* uvs;
192
192
{
193
193
{
@@ -267,9 +267,9 @@ core::smart_refctd_ptr<ICPUPolygonGeometry> CGeometryCreator::createCube(const h
267
267
};
268
268
const hlsl::vector<uv_element_t , 2 > uv[4 ] =
269
269
{
270
- hlsl::vector<uv_element_t ,2 >( 0 , MaxUvVal ),
271
- hlsl::vector<uv_element_t ,2 >(MaxUvVal, MaxUvVal ),
272
- hlsl::vector<uv_element_t ,2 >(MaxUvVal , 0 ),
270
+ hlsl::vector<uv_element_t ,2 >( 0 , UnityUV ),
271
+ hlsl::vector<uv_element_t ,2 >(UnityUV, UnityUV ),
272
+ hlsl::vector<uv_element_t ,2 >(UnityUV , 0 ),
273
273
hlsl::vector<uv_element_t ,2 >( 0 , 0 )
274
274
};
275
275
@@ -378,14 +378,15 @@ core::smart_refctd_ptr<ICPUPolygonGeometry> CGeometryCreator::createSphere(float
378
378
}
379
379
380
380
constexpr auto NormalCacheFormat = EF_R8G8B8_SNORM;
381
- constexpr auto NormalFormat = EF_R8G8B8A8_SNORM;
382
381
383
382
// Create vertex attributes with NONE usage because we have no clue how they'll be used
384
383
hlsl::float32_t3* positions;
385
384
386
385
snorm_normal_t * normals;
387
386
388
387
using uv_element_t = uint16_t ;
388
+ constexpr auto UnityUV = std::numeric_limits<uv_element_t >::max ();
389
+
389
390
hlsl::vector<uv_element_t , 2 >* uvs;
390
391
{
391
392
{
@@ -474,14 +475,14 @@ core::smart_refctd_ptr<ICPUPolygonGeometry> CGeometryCreator::createSphere(float
474
475
475
476
// the vertex at the top of the sphere
476
477
positions[vertex_i] = { 0 .f , radius, 0 .f };
477
- uvs[vertex_i] = { 0 , 63 };
478
+ uvs[vertex_i] = { 0 , UnityUV / 2 };
478
479
const auto quantizedTopNormal = quantNormalCache->quantize <NormalCacheFormat>(hlsl::float32_t3 (0 .f , 1 .f , 0 .f ));
479
480
memcpy (normals + vertex_i, &quantizedTopNormal, sizeof (quantizedTopNormal));
480
481
481
482
// the vertex at the bottom of the sphere
482
483
vertex_i++;
483
484
positions[vertex_i] = { 0 .f , -radius, 0 .f };
484
- uvs[vertex_i] = { 63 , 127 };
485
+ uvs[vertex_i] = { UnityUV / 2 , UnityUV };
485
486
const auto quantizedBottomNormal = quantNormalCache->quantize <NormalCacheFormat>(hlsl::float32_t3 (0 .f , -1 .f , 0 .f ));
486
487
memcpy (normals + vertex_i, &quantizedBottomNormal, sizeof (quantizedBottomNormal));
487
488
}
@@ -529,7 +530,6 @@ core::smart_refctd_ptr<ICPUPolygonGeometry> CGeometryCreator::createCylinder(
529
530
}
530
531
531
532
constexpr auto NormalCacheFormat = EF_R8G8B8_SNORM;
532
- constexpr auto NormalFormat = EF_R8G8B8A8_SNORM;
533
533
534
534
// Create vertex attributes with NONE usage because we have no clue how they'll be used
535
535
hlsl::float32_t3* positions;
@@ -628,7 +628,7 @@ core::smart_refctd_ptr<ICPUPolygonGeometry> CGeometryCreator::createCone(
628
628
629
629
// Create vertex attributes with NONE usage because we have no clue how they'll be used
630
630
hlsl::float32_t3* positions;
631
- hlsl::vector< int8_t , 4 > * normals;
631
+ snorm_normal_t * normals;
632
632
{
633
633
{
634
634
shapes::AABB<4 , float32_t > aabb;
@@ -860,7 +860,7 @@ core::smart_refctd_ptr<ICPUPolygonGeometry> CGeometryCreator::createDisk(const f
860
860
*(uvs++) = uint16_t2 (t*UnityUV+0 .5f ,0 );
861
861
}
862
862
}
863
- std::fill_n (normals,vertexCount,hlsl::vector< int8_t , 4 >( 0 , 0 , 127 , 0 ) );
863
+ std::fill_n (normals,vertexCount, snorm_positive_z );
864
864
865
865
CPolygonGeometryManipulator::recomputeContentHashes (retval.get ());
866
866
return retval;
0 commit comments