Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoTangentGenerator.h
1/*=================================================================================
2*** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3*** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4*** ***
5*** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6*** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7*** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8*** ***
9*** RESTRICTED RIGHTS LEGEND ***
10*** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11*** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12*** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13*** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14*** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15*** ***
16*** COPYRIGHT (C) 1996-2019 BY FEI S.A.S, ***
17*** BORDEAUX, FRANCE ***
18*** ALL RIGHTS RESERVED ***
19=================================================================================*/
20
21#pragma once
22
23#include <Inventor/SbLinear.h>
24#include <Inventor/elements/SoTangentBindingElement.h>
25
53{
54public:
55 SoTangentGenerator( bool useLines, int approxNumVertices = 16 );
56 ~SoTangentGenerator();
57
64 void setupApproxShapeSize( int32_t approxNumVertices );
65
70 void beginLineStrip();
71 void lineStripVertex( const SbVec3f& point );
72 void endLineStrip();
73
84 void setupIndexedVertexArray( const SbVec3f* pointArray );
85
90 void lineStripVertex( const int32_t pointIndex );
91
93 void generate();
94
100 int getNumTangents() const
101 {
102 return m_numVertTangents;
103 }
104
109 const SbVec3f* getTangents() const
110 {
111 return m_vertTangents;
112 }
113
118 const SbVec3f& getTangent( int32_t i ) const
119 {
120 return m_vertTangents[i];
121 }
122
123 SoTangentBindingElement::Binding getBinding() const
124 {
125 return m_binding;
126 }
127
136 void setTangent( int32_t index, const SbVec3f& newTangent );
137
138 private:
144 void setTangentBuffer( int32_t numTangents, const SbVec3f* tangents );
145
146private:
147 SbVec3f computeTangent( const SbVec3f& previous, const SbVec3f& current, const SbVec3f& next ) const;
148
149 std::vector<SbVec3f> m_tangents;
150 std::vector<SbVec3f> m_polylinePoints;
151
152 const SbVec3f* m_points;
153 const SbVec3f* m_vertTangents;
154
155 int32_t m_numVertTangents;
157 bool m_useLines;
158 static int s_generationMode;
159};
3D vector class.
Definition SbVec.h:932
Binding
The choice of values is for compatibility with Open Inventor 2.0 binary format files: