Lagrange
compute_tangent_bitangent.h
1/*
2 * Copyright 2020 Adobe. All rights reserved.
3 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License. You may obtain a copy
5 * of the License at http://www.apache.org/licenses/LICENSE-2.0
6 *
7 * Unless required by applicable law or agreed to in writing, software distributed under
8 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9 * OF ANY KIND, either express or implied. See the License for the specific language
10 * governing permissions and limitations under the License.
11 */
12#pragma once
13
14#ifdef LAGRANGE_ENABLE_LEGACY_FUNCTIONS
15 #include <lagrange/legacy/compute_tangent_bitangent.h>
16#endif
17
18#include <lagrange/SurfaceMesh.h>
19
20#include <string_view>
21
22namespace lagrange {
23
31
36{
38 std::string_view tangent_attribute_name = "@tangent";
39
41 std::string_view bitangent_attribute_name = "@bitangent";
42
45 std::string_view uv_attribute_name = "";
46
52 std::string_view normal_attribute_name = "";
53
56
59 bool pad_with_sign = false;
60};
61
64{
67
70};
71
89template <typename Scalar, typename Index>
92 TangentBitangentOptions options = {});
93
95
96} // namespace lagrange
uint32_t AttributeId
Identified to be used to access an attribute.
Definition: AttributeFwd.h:73
AttributeElement
Type of element to which the attribute is attached.
Definition: AttributeFwd.h:26
constexpr AttributeId invalid_attribute_id()
Invalid attribute id.
Definition: AttributeFwd.h:76
@ Indexed
Indexed mesh attributes.
Definition: AttributeFwd.h:45
TangentBitangentResult compute_tangent_bitangent(SurfaceMesh< Scalar, Index > &mesh, TangentBitangentOptions options={})
Compute mesh tangent and bitangent vectors orthogonal to the input mesh normals.
Definition: compute_tangent_bitangent.cpp:487
Main namespace for Lagrange.
Definition: AABBIGL.h:30
Option struct for computing tangent and bitangent vectors.
Definition: compute_tangent_bitangent.h:36
std::string_view bitangent_attribute_name
Output bitangent attribute name.
Definition: compute_tangent_bitangent.h:41
std::string_view normal_attribute_name
Normal attribute name used to compute the BTN frame.
Definition: compute_tangent_bitangent.h:52
std::string_view tangent_attribute_name
Output tangent attribute name.
Definition: compute_tangent_bitangent.h:38
AttributeElement output_element_type
Output element type. Can be either Corner or Indexed.
Definition: compute_tangent_bitangent.h:55
bool pad_with_sign
Whether to pad the tangent/bitangent vectors with a 4th coordinate indicating the sign of the UV tria...
Definition: compute_tangent_bitangent.h:59
std::string_view uv_attribute_name
UV attribute name used to orient the BTN frame.
Definition: compute_tangent_bitangent.h:45
Result type of the compute_tangent_bitangent function.
Definition: compute_tangent_bitangent.h:64
AttributeId tangent_id
Tangent vector attribute id.
Definition: compute_tangent_bitangent.h:66
AttributeId bitangent_id
Bitangent vector attribute id.
Definition: compute_tangent_bitangent.h:69