Skip to content

Commit 02d6c6d

Browse files
author
kevyuu
committed
Fix indentation in CGeometryCreator.cpp
1 parent ae5a755 commit 02d6c6d

File tree

1 file changed

+54
-54
lines changed

1 file changed

+54
-54
lines changed

src/nbl/asset/utils/CGeometryCreator.cpp

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -18,44 +18,44 @@ namespace nbl::asset
1818
using snorm_normal_t = hlsl::vector<int8_t, 4>;
1919
constexpr int8_t snorm_one = std::numeric_limits<int8_t>::max();
2020
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);
2323
constexpr auto snorm_positive_y = hlsl::vector<int8_t, 4>(0, snorm_one, 0, 0);
2424
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);
2626
constexpr auto snorm_negative_z = hlsl::vector<int8_t, 4>(0, 0, snorm_neg_one, 0);
2727

2828
constexpr auto snorm_all_ones = hlsl::vector<int8_t, 4>(snorm_one, snorm_one, snorm_one, snorm_one);
2929

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>)
3232
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+
{
3636
return EF_R8G8_UNORM;
37-
} else
38-
{
37+
} else
38+
{
3939
return EF_R16G16_UNORM;
40-
}
41-
}
40+
}
41+
}
4242

4343
}
4444

4545
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>)
4747
static ICPUPolygonGeometry::SDataView createUvView(size_t vertexCount)
4848
{
4949
const auto elementCount = 2;
5050
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);
5555

5656
auto retval = ICPUPolygonGeometry::SDataView{
5757
.composed = {
58-
.stride = attrSize,
58+
.stride = attrSize,
5959
},
6060
.src = {
6161
.offset = 0,
@@ -81,22 +81,22 @@ static ICPUPolygonGeometry::SDataView createUvView(size_t vertexCount)
8181
}
8282

8383
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>)
8585
static ICPUPolygonGeometry::SDataView createIndexView(size_t indexCount, size_t maxIndex)
8686
{
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});
9090

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;
9494

9595
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)},
100100
};
101101

102102
if constexpr(std::is_same_v<IndexT, uint16_t>)
@@ -116,20 +116,20 @@ static ICPUPolygonGeometry::SDataView createIndexView(size_t indexCount, size_t
116116
}
117117

118118
template <size_t ElementCountV = 3>
119-
requires(ElementCountV > 0 && ElementCountV <= 4)
119+
requires(ElementCountV > 0 && ElementCountV <= 4)
120120
static ICPUPolygonGeometry::SDataView createPositionView(size_t positionCount, const hlsl::shapes::AABB<4, hlsl::float32_t>& aabb)
121121
{
122122
using position_t = hlsl::vector<hlsl::float32_t, ElementCountV>;
123123
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});
125125

126126
constexpr auto format = []()
127127
{
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+
}();
133133

134134
return {
135135
.composed = {
@@ -145,22 +145,22 @@ static ICPUPolygonGeometry::SDataView createPositionView(size_t positionCount, c
145145
static ICPUPolygonGeometry::SDataView createSnormNormalView(size_t normalCount, const hlsl::shapes::AABB<4, int8_t>& aabb)
146146
{
147147
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+
};
158158
}
159159

160160
static void encodeUv(hlsl::vector<uint16_t, 2>* uvDst, hlsl::float32_t2 uvSrc)
161161
{
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);
164164
}
165165

166166
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
221221
}
222222

223223
{
224-
auto uvView = createUvView<uv_element_t>(CubeUniqueVertices);
224+
auto uvView = createUvView<uv_element_t>(CubeUniqueVertices);
225225
uvs = reinterpret_cast<decltype(uvs)>(uvView.src.buffer->getPointer());
226226
retval->getAuxAttributeViews()->push_back(std::move(uvView));
227227
}
@@ -657,7 +657,7 @@ core::smart_refctd_ptr<ICPUPolygonGeometry> CGeometryCreator::createCone(
657657
v *= radius;
658658
positions[i] = v;
659659
}
660-
positions[apexVertexBase_i] = apexVertexCoords;
660+
positions[apexVertexBase_i] = apexVertexCoords;
661661

662662
CPolygonGeometryManipulator::recomputeContentHashes(retval.get());
663663
return retval;
@@ -681,13 +681,13 @@ core::smart_refctd_ptr<ICPUGeometryCollection> CGeometryCreator::createArrow(
681681
auto* geometries = collection->getGeometries();
682682
geometries->push_back({
683683
.geometry = cylinder
684-
});
684+
});
685685
const auto coneTransform = hlsl::math::linalg::rotation_mat(-1.5707963268f, hlsl::float32_t3(1.f, 0.f, 0.f));
686686
geometries->push_back({
687687
.transform = hlsl::float32_t3x4(coneTransform),
688688
.geometry = cone
689-
});
690-
return collection;
689+
});
690+
return collection;
691691

692692
}
693693

@@ -1806,7 +1806,7 @@ core::smart_refctd_ptr<ICPUPolygonGeometry> CGeometryCreator::createIcoSphere(fl
18061806
}
18071807
{
18081808
using uv_element_t = uint16_t;
1809-
hlsl::vector<uv_element_t, 2>* uvs;
1809+
hlsl::vector<uv_element_t, 2>* uvs;
18101810
auto uvView = createUvView<uv_element_t>(icosphere.getVertexCount());
18111811
uvs = reinterpret_cast<decltype(uvs)>(uvView.src.buffer->getPointer());
18121812

0 commit comments

Comments
 (0)