@@ -493,13 +493,13 @@ core::smart_refctd_ptr<ICPUPolygonGeometry> CGeometryCreator::createSphere(float
493
493
494
494
core::smart_refctd_ptr<ICPUPolygonGeometry> CGeometryCreator::createCylinder (
495
495
float radius, float length,
496
- uint32_t tesselation, CQuantNormalCache* const quantNormalCacheOverride) const
496
+ uint16_t tesselation, CQuantNormalCache* const quantNormalCacheOverride) const
497
497
{
498
498
using namespace hlsl ;
499
499
500
500
CQuantNormalCache* const quantNormalCache = quantNormalCacheOverride == nullptr ? m_params.normalCache .get () : quantNormalCacheOverride;
501
501
502
- const auto halfIx = static_cast < uint16_t >( tesselation) ;
502
+ const auto halfIx = tesselation;
503
503
const uint32_t u32_vertexCount = 2 * tesselation;
504
504
if (u32_vertexCount > std::numeric_limits<uint16_t >::max ())
505
505
return nullptr ;
@@ -585,7 +585,7 @@ core::smart_refctd_ptr<ICPUPolygonGeometry> CGeometryCreator::createCylinder(
585
585
}
586
586
587
587
core::smart_refctd_ptr<ICPUPolygonGeometry> CGeometryCreator::createCone (
588
- float radius, float length, uint32_t tesselation,
588
+ float radius, float length, uint16_t tesselation,
589
589
float oblique, CQuantNormalCache* const quantNormalCacheOverride) const
590
590
{
591
591
@@ -690,8 +690,8 @@ core::smart_refctd_ptr<ICPUPolygonGeometry> CGeometryCreator::createCone(
690
690
}
691
691
692
692
core::vector<core::smart_refctd_ptr<ICPUPolygonGeometry>> CGeometryCreator::createArrow (
693
- const uint32_t tesselationCylinder,
694
- const uint32_t tesselationCone,
693
+ const uint16_t tesselationCylinder,
694
+ const uint16_t tesselationCone,
695
695
const float height,
696
696
const float cylinderHeight,
697
697
const float width0,
@@ -880,7 +880,7 @@ class Icosphere
880
880
public:
881
881
using index_t = unsigned int ;
882
882
883
- Icosphere (float radius = 1 .0f , int subdivision = 1 , bool smooth = false ) : radius(radius), subdivision(subdivision), smooth(smooth), interleavedStride( 32 )
883
+ Icosphere (float radius = 1 .0f , int subdivision = 1 , bool smooth = false ) : radius(radius), subdivision(subdivision), smooth(smooth)
884
884
{
885
885
if (smooth)
886
886
buildVerticesSmooth ();
@@ -909,12 +909,6 @@ class Icosphere
909
909
const unsigned int * getIndices () const { return indices.data (); }
910
910
const unsigned int * getLineIndices () const { return lineIndices.data (); }
911
911
912
- // for interleaved vertices: V/N/T
913
- unsigned int getInterleavedVertexCount () const { return getPositionCount (); } // # of vertices
914
- unsigned int getInterleavedVertexSize () const { return (unsigned int )interleavedVertices.size () * sizeof (float ); } // # of bytes
915
- int getInterleavedStride () const { return interleavedStride; } // should be 32 bytes
916
- const float * getInterleavedVertices () const { return interleavedVertices.data (); }
917
-
918
912
protected:
919
913
920
914
private:
@@ -1092,11 +1086,6 @@ class Icosphere
1092
1086
vertices[i] *= scale;
1093
1087
vertices[i + 1 ] *= scale;
1094
1088
vertices[i + 2 ] *= scale;
1095
-
1096
- // for interleaved array
1097
- interleavedVertices[j] *= scale;
1098
- interleavedVertices[j + 1 ] *= scale;
1099
- interleavedVertices[j + 2 ] *= scale;
1100
1089
}
1101
1090
}
1102
1091
@@ -1260,9 +1249,6 @@ class Icosphere
1260
1249
1261
1250
// subdivide icosahedron
1262
1251
subdivideVerticesFlat ();
1263
-
1264
- // generate interleaved vertex array as well
1265
- buildInterleavedVertices ();
1266
1252
}
1267
1253
1268
1254
/*
@@ -1485,8 +1471,6 @@ class Icosphere
1485
1471
// subdivide icosahedron
1486
1472
subdivideVerticesSmooth ();
1487
1473
1488
- // generate interleaved vertex array as well
1489
- buildInterleavedVertices ();
1490
1474
}
1491
1475
/*
1492
1476
divide a trinage into 4 sub triangles and repeat N times
@@ -1662,27 +1646,6 @@ class Icosphere
1662
1646
stride must be 32 bytes
1663
1647
*/
1664
1648
1665
- void buildInterleavedVertices ()
1666
- {
1667
- core::vector<float >().swap (interleavedVertices);
1668
-
1669
- std::size_t i, j;
1670
- std::size_t count = vertices.size ();
1671
- for (i = 0 , j = 0 ; i < count; i += 3 , j += 2 )
1672
- {
1673
- interleavedVertices.push_back (vertices[i]);
1674
- interleavedVertices.push_back (vertices[i + 1 ]);
1675
- interleavedVertices.push_back (vertices[i + 2 ]);
1676
-
1677
- interleavedVertices.push_back (normals[i]);
1678
- interleavedVertices.push_back (normals[i + 1 ]);
1679
- interleavedVertices.push_back (normals[i + 2 ]);
1680
-
1681
- interleavedVertices.push_back (texCoords[j]);
1682
- interleavedVertices.push_back (texCoords[j + 1 ]);
1683
- }
1684
- }
1685
-
1686
1649
void addVertex (float x, float y, float z)
1687
1650
{
1688
1651
vertices.push_back (x);
@@ -1826,9 +1789,6 @@ class Icosphere
1826
1789
core::vector<uint32_t > lineIndices;
1827
1790
std::map<std::pair<float , float >, uint32_t > sharedIndices; // indices of shared vertices, key is tex coord (s,t)
1828
1791
1829
- // interleaved
1830
- core::vector<float > interleavedVertices;
1831
- uint32_t interleavedStride; // # of bytes to hop to the next vertex (should be 32 bytes)
1832
1792
1833
1793
};
1834
1794
0 commit comments