Skip to content

Commit 90007e6

Browse files
committed
fix formatting, name
1 parent 5075c63 commit 90007e6

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

include/nbl/builtin/hlsl/shapes/triangle.hlsl

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,25 @@ namespace shapes
1818

1919
namespace util
2020
{
21-
// Use this convetion e_i = v_{i+2}-v_{i+1}. vertex index is modulo by 3.
22-
template <typename float_t>
23-
vector<float_t, 3> anglesFromTriangleEdge(const vector<float_t, 3> e0, vector<float_t, 3> e1, const vector<float_t, 3> e2)
24-
{
25-
// Calculate this triangle's weight for each of its three m_vertices
26-
// start by calculating the lengths of its sides
27-
const float_t a = hlsl::dot(e0, e0);
28-
const float_t asqrt = hlsl::sqrt(a);
29-
const float_t b = hlsl::dot(e1, e1);
30-
const float_t bsqrt = hlsl::sqrt(b);
31-
const float_t c = hlsl::dot(e2, e2);
32-
const float_t csqrt = hlsl::sqrt(c);
21+
// Use this convetion e_i = v_{i+2}-v_{i+1}. vertex index is modulo by 3.
22+
template <typename float_t>
23+
vector<float_t, 3> anglesFromTriangleEdges(const vector<float_t, 3> e0, vector<float_t, 3> e1, const vector<float_t, 3> e2)
24+
{
25+
// Calculate this triangle's weight for each of its three m_vertices
26+
// start by calculating the lengths of its sides
27+
const float_t a = hlsl::dot(e0, e0);
28+
const float_t asqrt = hlsl::sqrt(a);
29+
const float_t b = hlsl::dot(e1, e1);
30+
const float_t bsqrt = hlsl::sqrt(b);
31+
const float_t c = hlsl::dot(e2, e2);
32+
const float_t csqrt = hlsl::sqrt(c);
3333

34-
const float_t angle0 = hlsl::acos((b + c - a) / (2.f * bsqrt * csqrt));
35-
const float_t angle1 = hlsl::acos((-b + c + a) / (2.f * asqrt * csqrt));
36-
const float_t angle2 = hlsl::numbers::pi<float_t> - (angle0 + angle1);
37-
// use them to find the angle at each vertex
38-
return vector<float_t, 3>(angle0, angle1, angle2);
39-
}
34+
const float_t angle0 = hlsl::acos((b + c - a) / (2.f * bsqrt * csqrt));
35+
const float_t angle1 = hlsl::acos((-b + c + a) / (2.f * asqrt * csqrt));
36+
const float_t angle2 = hlsl::numbers::pi<float_t> - (angle0 + angle1);
37+
// use them to find the angle at each vertex
38+
return vector<float_t, 3>(angle0, angle1, angle2);
39+
}
4040
}
4141

4242
}

src/nbl/asset/utils/CSmoothNormalGenerator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ CSmoothNormalGenerator::VertexHashMap CSmoothNormalGenerator::setupData(const as
5858
const auto faceNormal = normalize(cross(v1 - v0, v2 - v0));
5959

6060
//set data for m_vertices
61-
const auto angleWages = hlsl::shapes::util::anglesFromTriangleEdge(v2 - v1, v0 - v2, v1 - v2);
61+
const auto angleWages = hlsl::shapes::util::anglesFromTriangleEdges(v2 - v1, v0 - v2, v1 - v2);
6262

6363
vertices.add({ i, 0, faceNormal * angleWages.x, v0});
6464
vertices.add({ i + 1, 0, faceNormal * angleWages.y,v1});

0 commit comments

Comments
 (0)