@@ -18,44 +18,44 @@ namespace nbl::asset
18
18
using snorm_normal_t = hlsl::vector<int8_t , 4 >;
19
19
constexpr int8_t snorm_one = std::numeric_limits<int8_t >::max();
20
20
constexpr int8_t snorm_neg_one = std::numeric_limits<int8_t >::min();
21
- constexpr auto snorm_positive_x = hlsl::vector<int8_t , 4 >(snorm_one, 0 , 0 , 0 );
22
- constexpr auto snorm_negative_x = hlsl::vector<int8_t , 4 >(snorm_neg_one, 0 , 0 , 0 );
21
+ constexpr auto snorm_positive_x = hlsl::vector<int8_t , 4 >(snorm_one, 0 , 0 , 0 );
22
+ constexpr auto snorm_negative_x = hlsl::vector<int8_t , 4 >(snorm_neg_one, 0 , 0 , 0 );
23
23
constexpr auto snorm_positive_y = hlsl::vector<int8_t , 4 >(0 , snorm_one, 0 , 0 );
24
24
constexpr auto snorm_negative_y = hlsl::vector<int8_t , 4 >(0 , snorm_neg_one, 0 , 0 );
25
- constexpr auto snorm_positive_z = hlsl::vector<int8_t , 4 >(0 , 0 , snorm_one, 0 );
25
+ constexpr auto snorm_positive_z = hlsl::vector<int8_t , 4 >(0 , 0 , snorm_one, 0 );
26
26
constexpr auto snorm_negative_z = hlsl::vector<int8_t , 4 >(0 , 0 , snorm_neg_one, 0 );
27
27
28
28
constexpr auto snorm_all_ones = hlsl::vector<int8_t , 4 >(snorm_one, snorm_one, snorm_one, snorm_one);
29
29
30
- template <typename ElementT>
31
- requires (std::is_same_v<ElementT, uint8_t > || std::is_same_v<ElementT, uint16_t >)
30
+ template <typename ElementT>
31
+ requires (std::is_same_v<ElementT, uint8_t > || std::is_same_v<ElementT, uint16_t >)
32
32
constexpr E_FORMAT get_uv_format()
33
- {
34
- if constexpr (std::is_same_v<ElementT, uint8_t >)
35
- {
33
+ {
34
+ if constexpr (std::is_same_v<ElementT, uint8_t >)
35
+ {
36
36
return EF_R8G8_UNORM;
37
- } else
38
- {
37
+ } else
38
+ {
39
39
return EF_R16G16_UNORM;
40
- }
41
- }
40
+ }
41
+ }
42
42
43
43
}
44
44
45
45
template <typename ElementT>
46
- requires (std::is_same_v<ElementT, uint8_t > || std::is_same_v<ElementT, uint16_t >)
46
+ requires (std::is_same_v<ElementT, uint8_t > || std::is_same_v<ElementT, uint16_t >)
47
47
static ICPUPolygonGeometry::SDataView createUvView(size_t vertexCount)
48
48
{
49
49
const auto elementCount = 2 ;
50
50
const auto attrSize = sizeof (ElementT) * elementCount;
51
- auto buff = ICPUBuffer::create ({{attrSize * vertexCount,IBuffer::EUF_NONE}});
52
- hlsl::shapes::AABB<4 , ElementT> aabb;
53
- aabb.minVx = hlsl::vector<ElementT, 4 >(0 ,0 ,0 ,0 );
54
- aabb.maxVx = hlsl::vector<ElementT, 4 >(std::numeric_limits<ElementT>::max (), std::numeric_limits<ElementT>::max (), 0 , 0 );
51
+ auto buff = ICPUBuffer::create ({{attrSize * vertexCount,IBuffer::EUF_NONE}});
52
+ hlsl::shapes::AABB<4 , ElementT> aabb;
53
+ aabb.minVx = hlsl::vector<ElementT, 4 >(0 ,0 ,0 ,0 );
54
+ aabb.maxVx = hlsl::vector<ElementT, 4 >(std::numeric_limits<ElementT>::max (), std::numeric_limits<ElementT>::max (), 0 , 0 );
55
55
56
56
auto retval = ICPUPolygonGeometry::SDataView{
57
57
.composed = {
58
- .stride = attrSize,
58
+ .stride = attrSize,
59
59
},
60
60
.src = {
61
61
.offset = 0 ,
@@ -81,22 +81,22 @@ static ICPUPolygonGeometry::SDataView createUvView(size_t vertexCount)
81
81
}
82
82
83
83
template <typename IndexT>
84
- requires (std::is_same_v<IndexT, uint16_t > || std::is_same_v<IndexT, uint32_t >)
84
+ requires (std::is_same_v<IndexT, uint16_t > || std::is_same_v<IndexT, uint32_t >)
85
85
static ICPUPolygonGeometry::SDataView createIndexView(size_t indexCount, size_t maxIndex)
86
86
{
87
-
88
- const auto bytesize = sizeof (IndexT) * indexCount;
89
- auto indices = ICPUBuffer::create ({bytesize,IBuffer::EUF_INDEX_BUFFER_BIT});
87
+
88
+ const auto bytesize = sizeof (IndexT) * indexCount;
89
+ auto indices = ICPUBuffer::create ({bytesize,IBuffer::EUF_INDEX_BUFFER_BIT});
90
90
91
- hlsl::shapes::AABB<4 ,IndexT> aabb;
92
- aabb.minVx [0 ] = 0 ;
93
- aabb.maxVx [0 ] = maxIndex;
91
+ hlsl::shapes::AABB<4 ,IndexT> aabb;
92
+ aabb.minVx [0 ] = 0 ;
93
+ aabb.maxVx [0 ] = maxIndex;
94
94
95
95
auto retval = ICPUPolygonGeometry::SDataView{
96
- .composed = {
97
- .stride = sizeof (IndexT),
98
- },
99
- .src = {.offset = 0 ,.size = bytesize,.buffer = std::move (indices)},
96
+ .composed = {
97
+ .stride = sizeof (IndexT),
98
+ },
99
+ .src = {.offset = 0 ,.size = bytesize,.buffer = std::move (indices)},
100
100
};
101
101
102
102
if constexpr (std::is_same_v<IndexT, uint16_t >)
@@ -116,20 +116,20 @@ static ICPUPolygonGeometry::SDataView createIndexView(size_t indexCount, size_t
116
116
}
117
117
118
118
template <size_t ElementCountV = 3 >
119
- requires (ElementCountV > 0 && ElementCountV <= 4 )
119
+ requires (ElementCountV > 0 && ElementCountV <= 4 )
120
120
static ICPUPolygonGeometry::SDataView createPositionView(size_t positionCount, const hlsl::shapes::AABB<4 , hlsl::float32_t >& aabb)
121
121
{
122
122
using position_t = hlsl::vector<hlsl::float32_t , ElementCountV>;
123
123
constexpr auto AttrSize = sizeof (position_t );
124
- auto buff = ICPUBuffer::create ({AttrSize * positionCount,IBuffer::EUF_NONE});
124
+ auto buff = ICPUBuffer::create ({AttrSize * positionCount,IBuffer::EUF_NONE});
125
125
126
126
constexpr auto format = []()
127
127
{
128
- if constexpr (ElementCountV == 1 ) return EF_R32_SFLOAT;
129
- if constexpr (ElementCountV == 2 ) return EF_R32G32_SFLOAT;
130
- if constexpr (ElementCountV == 3 ) return EF_R32G32B32_SFLOAT;
131
- if constexpr (ElementCountV == 4 ) return EF_R32G32B32A32_SFLOAT;
132
- }();
128
+ if constexpr (ElementCountV == 1 ) return EF_R32_SFLOAT;
129
+ if constexpr (ElementCountV == 2 ) return EF_R32G32_SFLOAT;
130
+ if constexpr (ElementCountV == 3 ) return EF_R32G32B32_SFLOAT;
131
+ if constexpr (ElementCountV == 4 ) return EF_R32G32B32A32_SFLOAT;
132
+ }();
133
133
134
134
return {
135
135
.composed = {
@@ -145,22 +145,22 @@ static ICPUPolygonGeometry::SDataView createPositionView(size_t positionCount, c
145
145
static ICPUPolygonGeometry::SDataView createSnormNormalView (size_t normalCount, const hlsl::shapes::AABB<4 , int8_t >& aabb)
146
146
{
147
147
constexpr auto AttrSize = sizeof (snorm_normal_t );
148
- auto buff = ICPUBuffer::create ({AttrSize * normalCount,IBuffer::EUF_NONE});
149
- return {
150
- .composed = {
151
- .encodedDataRange = {.s8 =aabb},
152
- .stride = AttrSize,
153
- .format = EF_R8G8B8A8_SNORM,
154
- .rangeFormat = IGeometryBase::EAABBFormat::S8_NORM
155
- },
156
- .src = {.offset =0 ,.size =buff->getSize (),.buffer =std::move (buff)}
157
- };
148
+ auto buff = ICPUBuffer::create ({AttrSize * normalCount,IBuffer::EUF_NONE});
149
+ return {
150
+ .composed = {
151
+ .encodedDataRange = {.s8 =aabb},
152
+ .stride = AttrSize,
153
+ .format = EF_R8G8B8A8_SNORM,
154
+ .rangeFormat = IGeometryBase::EAABBFormat::S8_NORM
155
+ },
156
+ .src = {.offset =0 ,.size =buff->getSize (),.buffer =std::move (buff)}
157
+ };
158
158
}
159
159
160
160
static void encodeUv (hlsl::vector<uint16_t , 2 >* uvDst, hlsl::float32_t2 uvSrc)
161
161
{
162
- uint32_t u32_uv = hlsl::packUnorm2x16 (uvSrc);
163
- memcpy (uvDst, &u32_uv, sizeof (uint16_t ) * 2 );
162
+ uint32_t u32_uv = hlsl::packUnorm2x16 (uvSrc);
163
+ memcpy (uvDst, &u32_uv, sizeof (uint16_t ) * 2 );
164
164
}
165
165
166
166
core::smart_refctd_ptr<ICPUPolygonGeometry> CGeometryCreator::createCube (const hlsl::float32_t3 size) const
@@ -221,7 +221,7 @@ core::smart_refctd_ptr<ICPUPolygonGeometry> CGeometryCreator::createCube(const h
221
221
}
222
222
223
223
{
224
- auto uvView = createUvView<uv_element_t >(CubeUniqueVertices);
224
+ auto uvView = createUvView<uv_element_t >(CubeUniqueVertices);
225
225
uvs = reinterpret_cast <decltype (uvs)>(uvView.src .buffer ->getPointer ());
226
226
retval->getAuxAttributeViews ()->push_back (std::move (uvView));
227
227
}
@@ -657,7 +657,7 @@ core::smart_refctd_ptr<ICPUPolygonGeometry> CGeometryCreator::createCone(
657
657
v *= radius;
658
658
positions[i] = v;
659
659
}
660
- positions[apexVertexBase_i] = apexVertexCoords;
660
+ positions[apexVertexBase_i] = apexVertexCoords;
661
661
662
662
CPolygonGeometryManipulator::recomputeContentHashes (retval.get ());
663
663
return retval;
@@ -681,13 +681,13 @@ core::smart_refctd_ptr<ICPUGeometryCollection> CGeometryCreator::createArrow(
681
681
auto * geometries = collection->getGeometries ();
682
682
geometries->push_back ({
683
683
.geometry = cylinder
684
- });
684
+ });
685
685
const auto coneTransform = hlsl::math::linalg::rotation_mat (-1 .5707963268f , hlsl::float32_t3 (1 .f , 0 .f , 0 .f ));
686
686
geometries->push_back ({
687
687
.transform = hlsl::float32_t3x4 (coneTransform),
688
688
.geometry = cone
689
- });
690
- return collection;
689
+ });
690
+ return collection;
691
691
692
692
}
693
693
@@ -1806,7 +1806,7 @@ core::smart_refctd_ptr<ICPUPolygonGeometry> CGeometryCreator::createIcoSphere(fl
1806
1806
}
1807
1807
{
1808
1808
using uv_element_t = uint16_t ;
1809
- hlsl::vector<uv_element_t , 2 >* uvs;
1809
+ hlsl::vector<uv_element_t , 2 >* uvs;
1810
1810
auto uvView = createUvView<uv_element_t >(icosphere.getVertexCount ());
1811
1811
uvs = reinterpret_cast <decltype (uvs)>(uvView.src .buffer ->getPointer ());
1812
1812
0 commit comments