DNA Calib 1.1
Project brief
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
dna Namespace Reference

Namespaces

namespace  anonymous_namespace{Writer.cpp}
 

Classes

class  AnimatedMapFilter
 
class  BaseImpl
 
class  BehaviorReader
 Read-only accessors for DNA attributes that define the rig's evaluation. More...
 
class  BehaviorWriter
 Write-only accessors for DNA attributes that define the rig's evaluation. More...
 
class  BinaryStreamReader
 
class  BinaryStreamReaderImpl
 
class  BinaryStreamWriter
 
class  BinaryStreamWriterImpl
 
class  BlendShapeFilter
 
struct  CoordinateSystem
 
class  DefinitionReader
 Read-only accessors for DNA attributes that represent the rig's static data. More...
 
class  DefinitionWriter
 Write-only accessors for DNA attributes that represent the rig's static data. More...
 
struct  DenormalizedData
 
class  DescriptorReader
 Read-only accessors for various metadata about the character and the rig. More...
 
class  DescriptorWriter
 Write-only accessors to various metadata about the character and the rig. More...
 
struct  DNA
 
struct  ExpectedValue
 
class  FilteredInputArchive
 
class  GeometryReader
 Read-only accessors to the geometry data associated with a rig. More...
 
class  GeometryWriter
 Write-only accessors for the geometry data associated with a rig. More...
 
class  JointFilter
 
class  JSONStreamReader
 
class  JSONStreamReaderImpl
 
class  JSONStreamWriter
 
class  JSONStreamWriterImpl
 
class  LODConstraint
 
struct  LODLimits
 
class  LODMapping
 
struct  MeshBlendShapeChannelMapping
 Mapping that associates a blend shape channel to it's mesh. More...
 
class  MeshFilter
 
struct  RawAnimatedMaps
 
struct  RawBehavior
 
struct  RawBlendShapeChannels
 
struct  RawBlendShapeTarget
 
struct  RawConditionalTable
 
struct  RawControls
 
struct  RawCoordinateSystem
 
struct  RawDefinition
 
struct  RawDescriptor
 
struct  RawFace
 
struct  RawGeometry
 
struct  RawJointGroup
 
struct  RawJoints
 
struct  RawLODMapping
 
struct  RawMesh
 
struct  RawPSDMatrix
 
struct  RawSurjectiveMapping
 
struct  RawTextureCoordinateVector
 
struct  RawVector3Vector
 
struct  RawVertexLayoutVector
 
struct  RawVertexSkinWeights
 
class  Reader
 The abstract Reader which its implementations are expected to inherit. More...
 
class  ReaderImpl
 
struct  SectionLookupTable
 
struct  Signature
 
class  StreamReader
 
class  StreamWriter
 
class  StringView
 
struct  SurjectiveMapping
 
struct  TextureCoordinate
 
struct  Vector3
 
struct  Version
 
struct  VertexLayout
 
class  Writer
 The abstract Writer which its implementations are expected to inherit. More...
 
class  WriterImpl
 

Typedefs

using Position = Vector3
 
using Normal = Vector3
 
using Delta = Vector3
 
template<typename T >
using ArrayView = trust::ArrayView< T >
 
template<typename T >
using ConstArrayView = trust::ConstArrayView< T >
 
template<typename T >
using AlignedAllocator = PolyAllocator< T, 64ul, AlignedMemoryResource >
 
template<typename T >
using DynArray = terse::DynArray< T, PolyAllocator< T > >
 
template<typename T >
using AlignedDynArray = terse::DynArray< T, AlignedAllocator< T > >
 
using IndicesGetter = std::function< ConstArrayView< std::uint16_t >(std::uint16_t)>
 
using IndicesSetter = std::function< void(std::uint16_t, const std::uint16_t *, std::uint16_t)>
 
using LODMappingSetter = std::function< void(std::uint16_t, std::uint16_t)>
 

Enumerations

enum class  DataLayer {
  Descriptor , Definition , Behavior , Geometry ,
  GeometryWithoutBlendShapes , AllWithoutBlendShapes , All
}
 
enum class  Archetype {
  asian , black , caucasian , hispanic ,
  alien , other
}
 
enum class  Gender { male , female , other }
 
enum class  TranslationUnit { cm , m }
 
enum class  RotationUnit { degrees , radians }
 
enum class  Direction {
  left , right , up , down ,
  front , back
}
 
enum class  DataLayerBitmask {
  Descriptor = 1 , Definition = 2 , Behavior = 4 , GeometryBlendShapesOnly = 8 ,
  GeometryRest = 16
}
 

Functions

bool operator== (const StringView &lhs, const StringView &rhs)
 
bool operator!= (const StringView &lhs, const StringView &rhs)
 
Vector3 operator+ (Vector3 lhs, const Vector3 &rhs)
 
Vector3 operator- (Vector3 lhs, const Vector3 &rhs)
 
Vector3 operator* (Vector3 lhs, const Vector3 &rhs)
 
Vector3 operator/ (Vector3 lhs, const Vector3 &rhs)
 
Vector3 operator+ (Vector3 lhs, float rhs)
 
Vector3 operator- (Vector3 lhs, float rhs)
 
Vector3 operator* (Vector3 lhs, float rhs)
 
Vector3 operator/ (Vector3 lhs, float rhs)
 
bool operator== (const Vector3 &lhs, const Vector3 &rhs)
 
bool operator!= (const Vector3 &lhs, const Vector3 &rhs)
 
DataLayerBitmask computeDataLayerBitmask (DataLayer layer)
 
template<typename T >
void remap (T originalCount, const UnorderedSet< T > &keptIndices, UnorderedMap< T, T > &mapping)
 
template<typename T , typename U >
static UnorderedMap< U, U > remappedPositions (const Vector< T > &target, const UnorderedSet< U > &indices, MemoryResource *memRes)
 
template<typename TEnum >
std::enable_if< std::is_enum< TEnum >::value, TEnum >::type operator& (TEnum lhs, TEnum rhs)
 
template<typename TEnum >
std::enable_if< std::is_enum< TEnum >::value, TEnum >::type operator| (TEnum lhs, TEnum rhs)
 
template<typename TEnum >
std::enable_if< std::is_enum< TEnum >::value, TEnum >::type operator^ (TEnum lhs, TEnum rhs)
 
template<typename TEnum >
std::enable_if< std::is_enum< TEnum >::value, TEnum >::type operator~ (TEnum value)
 
template<typename TEnum >
std::enable_if< std::is_enum< TEnum >::value, TEnum >::type operator&= (TEnum &lhs, TEnum rhs)
 
template<typename TEnum >
std::enable_if< std::is_enum< TEnum >::value, TEnum >::type operator|= (TEnum &lhs, TEnum rhs)
 
template<typename TEnum >
std::enable_if< std::is_enum< TEnum >::value, TEnum >::type operator^= (TEnum &lhs, TEnum rhs)
 
template<typename TEnum >
std::enable_if< std::is_enum< TEnum >::value, bool >::type contains (TEnum lhs, TEnum rhs)
 
template<typename TVector , typename TGetter >
static TVector collect_n (std::size_t count, TGetter getter, MemoryResource *memRes)
 
static void copyDescriptor (const DescriptorReader *source, DescriptorWriter *destination, MemoryResource *)
 
static std::pair< bool, std::uint16_t > findIndices (const Matrix< std::uint16_t > &source, ConstArrayView< std::uint16_t > indices)
 
static void copyNameIndices (IndicesGetter getIndices, IndicesSetter setIndices, LODMappingSetter setLODMapping, std::uint16_t lodCount, MemoryResource *memRes)
 
static void copyDefinition (const DefinitionReader *source, DefinitionWriter *destination, MemoryResource *memRes)
 
static void copyBehavior (const BehaviorReader *source, BehaviorWriter *destination, MemoryResource *)
 
static bool hasGeometry (const GeometryReader *source)
 
static void copyGeometry (const GeometryReader *source, GeometryWriter *destination, MemoryResource *memRes)
 
static bool hasBlendShapeTargets (const GeometryReader *source)
 
static void copyBlendShapeTargets (const GeometryReader *source, GeometryWriter *destination, MemoryResource *memRes)
 
template<class TContainer , typename ... Args>
void ensureHasSize (TContainer &target, std::size_t size, Args &&... args)
 

Variables

static constexpr std::uint16_t jointAttributeCount = 9u
 

Typedef Documentation

◆ AlignedAllocator

template<typename T >
using dna::AlignedAllocator = typedef PolyAllocator<T, 64ul, AlignedMemoryResource>

◆ AlignedDynArray

template<typename T >
using dna::AlignedDynArray = typedef terse::DynArray<T, AlignedAllocator<T> >

◆ ArrayView

template<typename T >
using dna::ArrayView = typedef trust::ArrayView<T>

◆ ConstArrayView

template<typename T >
using dna::ConstArrayView = typedef trust::ConstArrayView<T>

◆ Delta

using dna::Delta = typedef Vector3

◆ DynArray

template<typename T >
using dna::DynArray = typedef terse::DynArray<T, PolyAllocator<T> >

◆ IndicesGetter

using dna::IndicesGetter = typedef std::function<ConstArrayView<std::uint16_t>(std::uint16_t)>

◆ IndicesSetter

using dna::IndicesSetter = typedef std::function<void (std::uint16_t, const std::uint16_t*, std::uint16_t)>

◆ LODMappingSetter

using dna::LODMappingSetter = typedef std::function<void (std::uint16_t, std::uint16_t)>

◆ Normal

using dna::Normal = typedef Vector3

◆ Position

using dna::Position = typedef Vector3

Enumeration Type Documentation

◆ Archetype

enum class dna::Archetype
strong
Enumerator
asian 
black 
caucasian 
hispanic 
alien 
other 

◆ DataLayer

enum class dna::DataLayer
strong
Enumerator
Descriptor 
Definition 
Behavior 
Geometry 
GeometryWithoutBlendShapes 
AllWithoutBlendShapes 
All 
7 {
9 Definition, // Includes Descriptor
10 Behavior, // Includes Descriptor and Definition
11 Geometry, // Includes Descriptor and Definition
12 GeometryWithoutBlendShapes, // Includes Descriptor and Definition
13 AllWithoutBlendShapes, // Includes everything except blend shapes from Geometry
14 All
15};
@ GeometryWithoutBlendShapes

◆ DataLayerBitmask

enum class dna::DataLayerBitmask
strong
Enumerator
Descriptor 
Definition 
Behavior 
GeometryBlendShapesOnly 
GeometryRest 
10 {
11 Descriptor = 1,
12 Definition = 2,
13 Behavior = 4,
15 GeometryRest = 16,
16};

◆ Direction

enum class dna::Direction
strong
Enumerator
left 
right 
up 
down 
front 
back 

◆ Gender

enum class dna::Gender
strong
Enumerator
male 
female 
other 
16 {
17 male,
18 female,
19 other
20};

◆ RotationUnit

enum class dna::RotationUnit
strong
Enumerator
degrees 
radians 
27 {
28 degrees,
30};
std::enable_if< std::is_floating_point< T >::value, T >::type radians(T degrees)
Definition: Transforms.h:21
std::enable_if< std::is_floating_point< T >::value, T >::type degrees(T radians)
Definition: Transforms.h:15

◆ TranslationUnit

enum class dna::TranslationUnit
strong
Enumerator
cm 

Function Documentation

◆ collect_n()

template<typename TVector , typename TGetter >
static TVector dna::collect_n ( std::size_t  count,
TGetter  getter,
MemoryResource memRes 
)
static
36 {
37 TVector retval{memRes};
38 retval.reserve(count);
39 for (std::size_t i = 0ul; i < count; ++i) {
40 retval.push_back(getter(i));
41 }
42 return retval;
43}

◆ computeDataLayerBitmask()

DataLayerBitmask dna::computeDataLayerBitmask ( DataLayer  layer)
inline
18 {
19 DataLayerBitmask result = DataLayerBitmask::Descriptor;
20 if (layer == DataLayer::Definition) {
21 result |= DataLayerBitmask::Definition;
22 } else if (layer == DataLayer::Behavior) {
23 result |= DataLayerBitmask::Definition;
24 result |= DataLayerBitmask::Behavior;
25 } else if (layer == DataLayer::Geometry) {
26 result |= DataLayerBitmask::Definition;
27 result |= DataLayerBitmask::GeometryBlendShapesOnly;
28 result |= DataLayerBitmask::GeometryRest;
29 } else if (layer == DataLayer::GeometryWithoutBlendShapes) {
30 result |= DataLayerBitmask::Definition;
31 result |= DataLayerBitmask::GeometryRest;
32 } else if (layer == DataLayer::AllWithoutBlendShapes) {
33 result |= DataLayerBitmask::Definition;
34 result |= DataLayerBitmask::Behavior;
35 result |= DataLayerBitmask::GeometryRest;
36 } else if (layer == DataLayer::All) {
37 result |= DataLayerBitmask::Definition;
38 result |= DataLayerBitmask::Behavior;
39 result |= DataLayerBitmask::GeometryBlendShapesOnly;
40 result |= DataLayerBitmask::GeometryRest;
41 }
42 return result;
43}
DataLayerBitmask
Definition: DataLayerBitmask.h:10

References All, AllWithoutBlendShapes, Behavior, Definition, Descriptor, Geometry, GeometryBlendShapesOnly, GeometryRest, and GeometryWithoutBlendShapes.

Referenced by dna::Writer::setFrom().

◆ contains()

template<typename TEnum >
std::enable_if< std::is_enum< TEnum >::value, bool >::type dna::contains ( TEnum  lhs,
TEnum  rhs 
)
57 {
58 return (lhs & rhs) == rhs;
59}

Referenced by dna::FilteredInputArchive::process(), and dna::Writer::setFrom().

◆ copyBehavior()

static void dna::copyBehavior ( const BehaviorReader source,
BehaviorWriter destination,
MemoryResource  
)
static
200 {
201 destination->clearJointGroups();
202
203 auto guiToRawInputIndices = source->getGUIToRawInputIndices();
204 destination->setGUIToRawInputIndices(guiToRawInputIndices.data(), static_cast<std::uint16_t>(guiToRawInputIndices.size()));
205
206 auto guiToRawOutputIndices = source->getGUIToRawOutputIndices();
207 destination->setGUIToRawOutputIndices(guiToRawOutputIndices.data(), static_cast<std::uint16_t>(guiToRawOutputIndices.size()));
208
209 auto guiToRawFromValues = source->getGUIToRawFromValues();
210 destination->setGUIToRawFromValues(guiToRawFromValues.data(), static_cast<std::uint16_t>(guiToRawFromValues.size()));
211
212 auto guiToRawToValues = source->getGUIToRawToValues();
213 destination->setGUIToRawToValues(guiToRawToValues.data(), static_cast<std::uint16_t>(guiToRawToValues.size()));
214
215 auto guiToRawSlopeValues = source->getGUIToRawSlopeValues();
216 destination->setGUIToRawSlopeValues(guiToRawSlopeValues.data(), static_cast<std::uint16_t>(guiToRawSlopeValues.size()));
217
218 auto guiToRawCutValues = source->getGUIToRawCutValues();
219 destination->setGUIToRawCutValues(guiToRawCutValues.data(), static_cast<std::uint16_t>(guiToRawCutValues.size()));
220
221 destination->setPSDCount(source->getPSDCount());
222
223 auto psdRowIndices = source->getPSDRowIndices();
224 destination->setPSDRowIndices(psdRowIndices.data(), static_cast<std::uint16_t>(psdRowIndices.size()));
225
226 auto psdColumnIndices = source->getPSDColumnIndices();
227 destination->setPSDColumnIndices(psdColumnIndices.data(), static_cast<std::uint16_t>(psdColumnIndices.size()));
228
229 auto psdValues = source->getPSDValues();
230 destination->setPSDValues(psdValues.data(), static_cast<std::uint16_t>(psdValues.size()));
231
232 destination->setJointRowCount(source->getJointRowCount());
233 destination->setJointColumnCount(source->getJointColumnCount());
234
235 for (std::uint16_t jointGroupIndexPlusOne = source->getJointGroupCount();
236 jointGroupIndexPlusOne > 0u;
237 --jointGroupIndexPlusOne) {
238 const auto jointGroupIndex = static_cast<std::uint16_t>(jointGroupIndexPlusOne - 1u);
239
240 auto jointGroupLODs = source->getJointGroupLODs(jointGroupIndex);
241 destination->setJointGroupLODs(jointGroupIndex, jointGroupLODs.data(), static_cast<std::uint16_t>(jointGroupLODs.size()));
242
243 auto jointGroupInputIndices = source->getJointGroupInputIndices(jointGroupIndex);
244 destination->setJointGroupInputIndices(jointGroupIndex, jointGroupInputIndices.data(),
245 static_cast<std::uint16_t>(jointGroupInputIndices.size()));
246
247 auto jointGroupOutputIndices = source->getJointGroupOutputIndices(jointGroupIndex);
248 destination->setJointGroupOutputIndices(jointGroupIndex, jointGroupOutputIndices.data(),
249 static_cast<std::uint16_t>(jointGroupOutputIndices.size()));
250
251 auto jointGroupValues = source->getJointGroupValues(jointGroupIndex);
252 destination->setJointGroupValues(jointGroupIndex, jointGroupValues.data(),
253 static_cast<std::uint32_t>(jointGroupValues.size()));
254
255 auto jointGroupJointIndices = source->getJointGroupJointIndices(jointGroupIndex);
256 destination->setJointGroupJointIndices(jointGroupIndex, jointGroupJointIndices.data(),
257 static_cast<std::uint16_t>(jointGroupJointIndices.size()));
258 }
259
260 auto blendShapeLODs = source->getBlendShapeChannelLODs();
261 destination->setBlendShapeChannelLODs(blendShapeLODs.data(), static_cast<std::uint16_t>(blendShapeLODs.size()));
262
263 auto blendShapeInputIndices = source->getBlendShapeChannelInputIndices();
264 destination->setBlendShapeChannelInputIndices(blendShapeInputIndices.data(),
265 static_cast<std::uint16_t>(blendShapeInputIndices.size()));
266
267 auto blendShapeOutputIndices = source->getBlendShapeChannelOutputIndices();
268 destination->setBlendShapeChannelOutputIndices(blendShapeOutputIndices.data(),
269 static_cast<std::uint16_t>(blendShapeOutputIndices.size()));
270
271 auto animatedMapLODs = source->getAnimatedMapLODs();
272 destination->setAnimatedMapLODs(animatedMapLODs.data(), static_cast<std::uint16_t>(animatedMapLODs.size()));
273
274 auto animatedMapInputIndices = source->getAnimatedMapInputIndices();
275 destination->setAnimatedMapInputIndices(animatedMapInputIndices.data(),
276 static_cast<std::uint16_t>(animatedMapInputIndices.size()));
277
278 auto animatedMapOutputIndices = source->getAnimatedMapOutputIndices();
279 destination->setAnimatedMapOutputIndices(animatedMapOutputIndices.data(),
280 static_cast<std::uint16_t>(animatedMapOutputIndices.size()));
281
282 auto animatedMapFromValues = source->getAnimatedMapFromValues();
283 destination->setAnimatedMapFromValues(animatedMapFromValues.data(), static_cast<std::uint16_t>(animatedMapFromValues.size()));
284
285 auto animatedMapToValues = source->getAnimatedMapToValues();
286 destination->setAnimatedMapToValues(animatedMapToValues.data(), static_cast<std::uint16_t>(animatedMapToValues.size()));
287
288 auto animatedMapSlopeValues = source->getAnimatedMapSlopeValues();
289 destination->setAnimatedMapSlopeValues(animatedMapSlopeValues.data(),
290 static_cast<std::uint16_t>(animatedMapSlopeValues.size()));
291
292 auto animatedMapCutValues = source->getAnimatedMapCutValues();
293 destination->setAnimatedMapCutValues(animatedMapCutValues.data(), static_cast<std::uint16_t>(animatedMapCutValues.size()));
294}
virtual ConstArrayView< std::uint16_t > getJointGroupInputIndices(std::uint16_t jointGroupIndex) const =0
Column indices that the requested joint group contains.
virtual ConstArrayView< float > getGUIToRawSlopeValues() const =0
Computational values(slope/gradient) used for calculating the output value during gui to raw control ...
virtual ConstArrayView< std::uint16_t > getPSDRowIndices() const =0
PSD(input) indices.
virtual ConstArrayView< float > getAnimatedMapToValues() const =0
Filter values(upper-bounds) used to decide whether a particular entry should be evaluated or not.
virtual ConstArrayView< std::uint16_t > getBlendShapeChannelOutputIndices() const =0
Output indices specify the positions of blend shape channel output values.
virtual ConstArrayView< std::uint16_t > getPSDColumnIndices() const =0
Control(input) indices.
virtual ConstArrayView< float > getGUIToRawFromValues() const =0
Filter values(lower-bounds) used to decide whether a particular entry should be evaluated or not duri...
virtual ConstArrayView< std::uint16_t > getAnimatedMapInputIndices() const =0
Input indices used to index into the array of input values.
virtual ConstArrayView< std::uint16_t > getAnimatedMapLODs() const =0
Row count per each level of detail for animated maps.
virtual ConstArrayView< float > getAnimatedMapSlopeValues() const =0
Computational values(slope/gradient) used for calculating the output value.
virtual ConstArrayView< std::uint16_t > getAnimatedMapOutputIndices() const =0
Output indices that specify the computed output value's position.
virtual std::uint16_t getJointRowCount() const =0
Number of rows in the entire, uncompressed joint matrix.
virtual std::uint16_t getPSDCount() const =0
The number of distinct PSD expressions.
virtual ConstArrayView< float > getGUIToRawCutValues() const =0
Computational values(vertical intercept) used for calculating the output value during gui to raw cont...
virtual ConstArrayView< std::uint16_t > getGUIToRawInputIndices() const =0
Input indices used for mapping gui to raw controls.
virtual ConstArrayView< float > getAnimatedMapCutValues() const =0
Computational values(vertical intercept) used for calculating the output value.
virtual ConstArrayView< std::uint16_t > getJointGroupOutputIndices(std::uint16_t jointGroupIndex) const =0
Row indices that the requested joint group contains.
virtual ConstArrayView< std::uint16_t > getGUIToRawOutputIndices() const =0
Output indices used for mapping gui to raw controls.
virtual ConstArrayView< float > getPSDValues() const =0
Weights associated with each PSD row and column pair.
virtual ConstArrayView< float > getGUIToRawToValues() const =0
Filter values(upper-bounds) used to decide whether a particular entry should be evaluated or not duri...
virtual std::uint16_t getJointGroupCount() const =0
Number of joint groups present in the entire joint matrix.
virtual ConstArrayView< std::uint16_t > getBlendShapeChannelLODs() const =0
Input index count per each level of detail for blend shape channels.
virtual std::uint16_t getJointColumnCount() const =0
Number of columns in the entire, uncompressed joint matrix.
virtual ConstArrayView< float > getJointGroupValues(std::uint16_t jointGroupIndex) const =0
Values that the requested joint group contains.
virtual ConstArrayView< std::uint16_t > getBlendShapeChannelInputIndices() const =0
Input indices used to index into the input vector.
virtual ConstArrayView< std::uint16_t > getJointGroupJointIndices(std::uint16_t jointGroupIndex) const =0
Joint indices that the requested joint group contains.
virtual ConstArrayView< float > getAnimatedMapFromValues() const =0
Filter values(lower-bounds) used to decide whether a particular entry should be evaluated or not.
virtual ConstArrayView< std::uint16_t > getJointGroupLODs(std::uint16_t jointGroupIndex) const =0
Number of rows per each level of detail for the requested joint group.
virtual void setJointGroupLODs(std::uint16_t jointGroupIndex, const std::uint16_t *lods, std::uint16_t count)=0
Number of rows per each level of detail for the specified joint group.
virtual void setBlendShapeChannelInputIndices(const std::uint16_t *inputIndices, std::uint16_t count)=0
Input indices used to index into the input vector.
virtual void setJointGroupOutputIndices(std::uint16_t jointGroupIndex, const std::uint16_t *outputIndices, std::uint16_t count)=0
Row indices that the specified joint group contains.
virtual void setAnimatedMapCutValues(const float *cutValues, std::uint16_t count)=0
Computational values(vertical intercept) used for calculating the output value.
virtual void setGUIToRawInputIndices(const std::uint16_t *inputIndices, std::uint16_t count)=0
Input indices used for mapping gui to raw controls.
virtual void setJointRowCount(std::uint16_t rowCount)=0
Number of rows in the entire, uncompressed joint matrix.
virtual void setPSDCount(std::uint16_t count)=0
The number of distinct PSD expressions.
virtual void setAnimatedMapToValues(const float *toValues, std::uint16_t count)=0
Filter values(upper-bounds) used to decide whether a particular entry should be evaluated or not.
virtual void setGUIToRawSlopeValues(const float *slopeValues, std::uint16_t count)=0
Computational values(slope/gradient) used for calculating the output value during gui to raw control ...
virtual void clearJointGroups()=0
Delete all joint groups.
virtual void setAnimatedMapInputIndices(const std::uint16_t *inputIndices, std::uint16_t count)=0
Input indices used to index into the array of input values.
virtual void setGUIToRawToValues(const float *toValues, std::uint16_t count)=0
Filter values(upper-bounds) used to decide whether a particular entry should be evaluated or not duri...
virtual void setAnimatedMapSlopeValues(const float *slopeValues, std::uint16_t count)=0
Computational values(slope/gradient) used for calculating the output value.
virtual void setAnimatedMapLODs(const std::uint16_t *lods, std::uint16_t count)=0
Row count per each level of detail for animated maps.
virtual void setPSDRowIndices(const std::uint16_t *rowIndices, std::uint16_t count)=0
PSD(input) indices which will become the rows of the PSD matrix.
virtual void setGUIToRawOutputIndices(const std::uint16_t *outputIndices, std::uint16_t count)=0
Output indices used for mapping gui to raw controls.
virtual void setJointGroupValues(std::uint16_t jointGroupIndex, const float *values, std::uint32_t count)=0
Values that the specified joint group contains.
virtual void setBlendShapeChannelLODs(const std::uint16_t *lods, std::uint16_t count)=0
Input index count per each level of detail for blend shapes.
virtual void setJointGroupInputIndices(std::uint16_t jointGroupIndex, const std::uint16_t *inputIndices, std::uint16_t count)=0
Column indices that the specified joint group contains.
virtual void setPSDValues(const float *weights, std::uint16_t count)=0
Weights associated with each PSD row and column pair.
virtual void setJointGroupJointIndices(std::uint16_t jointGroupIndex, const std::uint16_t *jointIndices, std::uint16_t count)=0
Joint indices that the specified joint group contains.
virtual void setBlendShapeChannelOutputIndices(const std::uint16_t *outputIndices, std::uint16_t count)=0
Output indices specify the positions of blend shape output values.
virtual void setAnimatedMapOutputIndices(const std::uint16_t *outputIndices, std::uint16_t count)=0
Output indices that specify the computed output value's position.
virtual void setGUIToRawFromValues(const float *fromValues, std::uint16_t count)=0
Filter values(lower-bounds) used to decide whether a particular entry should be evaluated or not duri...
virtual void setGUIToRawCutValues(const float *cutValues, std::uint16_t count)=0
Computational values(vertical intercept) used for calculating the output value during gui to raw cont...
virtual void setAnimatedMapFromValues(const float *fromValues, std::uint16_t count)=0
Filter values(lower-bounds) used to decide whether a particular entry should be evaluated or not.
virtual void setJointColumnCount(std::uint16_t columnCount)=0
Number of columns in the entire, uncompressed joint matrix.
virtual void setPSDColumnIndices(const std::uint16_t *columnIndices, std::uint16_t count)=0
Control(input) indices which will become the columns of the PSD matrix.

References dna::BehaviorWriter::clearJointGroups(), dna::BehaviorReader::getAnimatedMapCutValues(), dna::BehaviorReader::getAnimatedMapFromValues(), dna::BehaviorReader::getAnimatedMapInputIndices(), dna::BehaviorReader::getAnimatedMapLODs(), dna::BehaviorReader::getAnimatedMapOutputIndices(), dna::BehaviorReader::getAnimatedMapSlopeValues(), dna::BehaviorReader::getAnimatedMapToValues(), dna::BehaviorReader::getBlendShapeChannelInputIndices(), dna::BehaviorReader::getBlendShapeChannelLODs(), dna::BehaviorReader::getBlendShapeChannelOutputIndices(), dna::BehaviorReader::getGUIToRawCutValues(), dna::BehaviorReader::getGUIToRawFromValues(), dna::BehaviorReader::getGUIToRawInputIndices(), dna::BehaviorReader::getGUIToRawOutputIndices(), dna::BehaviorReader::getGUIToRawSlopeValues(), dna::BehaviorReader::getGUIToRawToValues(), dna::BehaviorReader::getJointColumnCount(), dna::BehaviorReader::getJointGroupCount(), dna::BehaviorReader::getJointGroupInputIndices(), dna::BehaviorReader::getJointGroupJointIndices(), dna::BehaviorReader::getJointGroupLODs(), dna::BehaviorReader::getJointGroupOutputIndices(), dna::BehaviorReader::getJointGroupValues(), dna::BehaviorReader::getJointRowCount(), dna::BehaviorReader::getPSDColumnIndices(), dna::BehaviorReader::getPSDCount(), dna::BehaviorReader::getPSDRowIndices(), dna::BehaviorReader::getPSDValues(), dna::BehaviorWriter::setAnimatedMapCutValues(), dna::BehaviorWriter::setAnimatedMapFromValues(), dna::BehaviorWriter::setAnimatedMapInputIndices(), dna::BehaviorWriter::setAnimatedMapLODs(), dna::BehaviorWriter::setAnimatedMapOutputIndices(), dna::BehaviorWriter::setAnimatedMapSlopeValues(), dna::BehaviorWriter::setAnimatedMapToValues(), dna::BehaviorWriter::setBlendShapeChannelInputIndices(), dna::BehaviorWriter::setBlendShapeChannelLODs(), dna::BehaviorWriter::setBlendShapeChannelOutputIndices(), dna::BehaviorWriter::setGUIToRawCutValues(), dna::BehaviorWriter::setGUIToRawFromValues(), dna::BehaviorWriter::setGUIToRawInputIndices(), dna::BehaviorWriter::setGUIToRawOutputIndices(), dna::BehaviorWriter::setGUIToRawSlopeValues(), dna::BehaviorWriter::setGUIToRawToValues(), dna::BehaviorWriter::setJointColumnCount(), dna::BehaviorWriter::setJointGroupInputIndices(), dna::BehaviorWriter::setJointGroupJointIndices(), dna::BehaviorWriter::setJointGroupLODs(), dna::BehaviorWriter::setJointGroupOutputIndices(), dna::BehaviorWriter::setJointGroupValues(), dna::BehaviorWriter::setJointRowCount(), dna::BehaviorWriter::setPSDColumnIndices(), dna::BehaviorWriter::setPSDCount(), dna::BehaviorWriter::setPSDRowIndices(), and dna::BehaviorWriter::setPSDValues().

Referenced by dna::Writer::setFrom().

◆ copyBlendShapeTargets()

static void dna::copyBlendShapeTargets ( const GeometryReader source,
GeometryWriter destination,
MemoryResource memRes 
)
static
384 {
385 if (!hasBlendShapeTargets(source)) {
386 // Source DNA was loaded without blend shape targets
387 return;
388 }
389
390 for (std::uint16_t meshIndexPlusOne = source->getMeshCount(); meshIndexPlusOne > 0u; --meshIndexPlusOne) {
391 const auto meshIndex = static_cast<std::uint16_t>(meshIndexPlusOne - 1u);
392 for (std::uint16_t blendShapeTargetIndexPlusOne = source->getBlendShapeTargetCount(meshIndex);
393 blendShapeTargetIndexPlusOne > 0u;
394 --blendShapeTargetIndexPlusOne) {
395 const auto blendShapeTargetIndex = static_cast<std::uint16_t>(blendShapeTargetIndexPlusOne - 1u);
396 auto channelIndex = source->getBlendShapeChannelIndex(meshIndex, blendShapeTargetIndex);
397 destination->setBlendShapeChannelIndex(meshIndex, blendShapeTargetIndex, channelIndex);
398 auto deltaCount = source->getBlendShapeTargetDeltaCount(meshIndex, blendShapeTargetIndex);
399 auto deltas = collect_n<Vector3Vector>(deltaCount, [source, meshIndex, blendShapeTargetIndex](std::size_t index) {
400 return source->getBlendShapeTargetDelta(meshIndex, blendShapeTargetIndex,
401 static_cast<std::uint32_t>(index));
402 }, memRes);
403 destination->setBlendShapeTargetDeltas(meshIndex, blendShapeTargetIndex, deltas.data(),
404 static_cast<std::uint32_t>(deltas.size()));
405
406 auto deltasVertices = source->getBlendShapeTargetVertexIndices(meshIndex, blendShapeTargetIndex);
407 destination->setBlendShapeTargetVertexIndices(meshIndex, blendShapeTargetIndex, deltasVertices.data(),
408 static_cast<std::uint32_t>(deltasVertices.size()));
409 }
410 }
411}
virtual std::uint16_t getMeshCount() const =0
virtual std::uint32_t getBlendShapeTargetDeltaCount(std::uint16_t meshIndex, std::uint16_t blendShapeTargetIndex) const =0
Number of deltas that belong to the specified blend shape.
virtual ConstArrayView< std::uint32_t > getBlendShapeTargetVertexIndices(std::uint16_t meshIndex, std::uint16_t blendShapeTargetIndex) const =0
Vertex position indices affected by the referenced blend shape target.
virtual std::uint16_t getBlendShapeTargetCount(std::uint16_t meshIndex) const =0
Number of blend shapes that belong to the specified mesh.
virtual Delta getBlendShapeTargetDelta(std::uint16_t meshIndex, std::uint16_t blendShapeTargetIndex, std::uint32_t deltaIndex) const =0
List of deltas for each affected vertex.
virtual std::uint16_t getBlendShapeChannelIndex(std::uint16_t meshIndex, std::uint16_t blendShapeTargetIndex) const =0
The matching blend shape channel index of the requested blend shape target.
virtual void setBlendShapeTargetVertexIndices(std::uint16_t meshIndex, std::uint16_t blendShapeTargetIndex, const std::uint32_t *vertexIndices, std::uint32_t count)=0
Vertex position indices affected by the specified blend shape target.
virtual void setBlendShapeTargetDeltas(std::uint16_t meshIndex, std::uint16_t blendShapeTargetIndex, const Delta *deltas, std::uint32_t count)=0
List of deltas for each affected vertex.
virtual void setBlendShapeChannelIndex(std::uint16_t meshIndex, std::uint16_t blendShapeTargetIndex, std::uint16_t blendShapeChannelIndex)=0
The matching blend shape channel index of the specified blend shape target.
static bool hasBlendShapeTargets(const GeometryReader *source)
Definition: Writer.cpp:374

References dna::GeometryReader::getBlendShapeChannelIndex(), dna::GeometryReader::getBlendShapeTargetCount(), dna::GeometryReader::getBlendShapeTargetDelta(), dna::GeometryReader::getBlendShapeTargetDeltaCount(), dna::GeometryReader::getBlendShapeTargetVertexIndices(), dna::DefinitionReader::getMeshCount(), hasBlendShapeTargets(), dna::GeometryWriter::setBlendShapeChannelIndex(), dna::GeometryWriter::setBlendShapeTargetDeltas(), and dna::GeometryWriter::setBlendShapeTargetVertexIndices().

Referenced by dna::Writer::setFrom().

◆ copyDefinition()

static void dna::copyDefinition ( const DefinitionReader source,
DefinitionWriter destination,
MemoryResource memRes 
)
static
105 {
106 destination->clearGUIControlNames();
107 destination->clearRawControlNames();
108 destination->clearJointNames();
109 destination->clearBlendShapeChannelNames();
110 destination->clearAnimatedMapNames();
111 destination->clearMeshNames();
112 destination->clearJointIndices();
113 destination->clearLODJointMappings();
114 destination->clearBlendShapeChannelIndices();
116 destination->clearAnimatedMapIndices();
117 destination->clearLODAnimatedMapMappings();
118 destination->clearMeshIndices();
119 destination->clearLODMeshMappings();
121
122 const auto lodCount = source->getLODCount();
123
124 for (std::uint16_t i = source->getGUIControlCount(); i > 0u; --i) {
125 const auto idx = static_cast<std::uint16_t>(i - 1u);
126 destination->setGUIControlName(idx, source->getGUIControlName(idx).data());
127 }
128 for (std::uint16_t i = source->getRawControlCount(); i > 0u; --i) {
129 const auto idx = static_cast<std::uint16_t>(i - 1u);
130 destination->setRawControlName(idx, source->getRawControlName(idx).data());
131 }
132 for (std::uint16_t i = source->getJointCount(); i > 0u; --i) {
133 const auto idx = static_cast<std::uint16_t>(i - 1u);
134 destination->setJointName(idx, source->getJointName(idx).data());
135 }
136 for (std::uint16_t i = source->getBlendShapeChannelCount(); i > 0u; --i) {
137 const auto idx = static_cast<std::uint16_t>(i - 1u);
138 destination->setBlendShapeChannelName(idx, source->getBlendShapeChannelName(idx).data());
139 }
140 for (std::uint16_t i = source->getAnimatedMapCount(); i > 0u; --i) {
141 const auto idx = static_cast<std::uint16_t>(i - 1u);
142 destination->setAnimatedMapName(idx, source->getAnimatedMapName(idx));
143 }
144 for (std::uint16_t i = source->getMeshCount(); i > 0u; --i) {
145 const auto idx = static_cast<std::uint16_t>(i - 1u);
146 destination->setMeshName(idx, source->getMeshName(idx).data());
147 }
148
149 using namespace std::placeholders;
151 std::bind(&DefinitionReader::getJointIndicesForLOD, source, _1),
152 std::bind(&DefinitionWriter::setJointIndices, destination, _1, _2, _3),
153 std::bind(&DefinitionWriter::setLODJointMapping, destination, _1, _2),
154 lodCount,
155 memRes);
157 std::bind(&DefinitionReader::getBlendShapeChannelIndicesForLOD, source, _1),
158 std::bind(&DefinitionWriter::setBlendShapeChannelIndices, destination, _1, _2, _3),
159 std::bind(&DefinitionWriter::setLODBlendShapeChannelMapping, destination, _1, _2),
160 lodCount,
161 memRes);
163 std::bind(&DefinitionReader::getAnimatedMapIndicesForLOD, source, _1),
164 std::bind(&DefinitionWriter::setAnimatedMapIndices, destination, _1, _2, _3),
165 std::bind(&DefinitionWriter::setLODAnimatedMapMapping, destination, _1, _2),
166 lodCount,
167 memRes);
169 std::bind(&DefinitionReader::getMeshIndicesForLOD, source, _1),
170 std::bind(&DefinitionWriter::setMeshIndices, destination, _1, _2, _3),
171 std::bind(&DefinitionWriter::setLODMeshMapping, destination, _1, _2),
172 lodCount,
173 memRes);
174
175 Vector<std::uint16_t> jointHierarchy{memRes};
176 jointHierarchy.reserve(source->getJointCount());
177 for (std::uint16_t i = 0u; i < source->getJointCount(); ++i) {
178 jointHierarchy.push_back(source->getJointParentIndex(i));
179 }
180 destination->setJointHierarchy(jointHierarchy.data(), static_cast<std::uint16_t>(jointHierarchy.size()));
181
182 for (std::uint16_t i = 0u; i < source->getMeshBlendShapeChannelMappingCount(); ++i) {
183 auto mapping = source->getMeshBlendShapeChannelMapping(i);
184 destination->setMeshBlendShapeChannelMapping(i, mapping.meshIndex, mapping.blendShapeChannelIndex);
185 }
186
187 auto jointCount = source->getJointCount();
188
189 auto translations = collect_n<Vector3Vector>(jointCount, [source](std::size_t index) {
190 return source->getNeutralJointTranslation(static_cast<std::uint16_t>(index));
191 }, memRes);
192 destination->setNeutralJointTranslations(translations.data(), static_cast<std::uint16_t>(translations.size()));
193
194 auto rotations = collect_n<Vector3Vector>(jointCount, [source](std::size_t index) {
195 return source->getNeutralJointRotation(static_cast<std::uint16_t>(index));
196 }, memRes);
197 destination->setNeutralJointRotations(rotations.data(), static_cast<std::uint16_t>(rotations.size()));
198}
virtual StringView getAnimatedMapName(std::uint16_t index) const =0
Name of the requested animated map.
virtual std::uint16_t getRawControlCount() const =0
virtual StringView getMeshName(std::uint16_t index) const =0
Name of the requested mesh.
virtual Vector3 getNeutralJointRotation(std::uint16_t index) const =0
virtual MeshBlendShapeChannelMapping getMeshBlendShapeChannelMapping(std::uint16_t index) const =0
virtual StringView getRawControlName(std::uint16_t index) const =0
Name of the requested raw control.
virtual std::uint16_t getGUIControlCount() const =0
virtual std::uint16_t getAnimatedMapCount() const =0
virtual std::uint16_t getJointParentIndex(std::uint16_t index) const =0
Index of the requested joint's parent.
virtual StringView getBlendShapeChannelName(std::uint16_t index) const =0
Name of the requested blend shape channel.
virtual std::uint16_t getMeshBlendShapeChannelMappingCount() const =0
Number of mesh-blend shape channel mapping items.
virtual std::uint16_t getBlendShapeChannelCount() const =0
virtual Vector3 getNeutralJointTranslation(std::uint16_t index) const =0
virtual std::uint16_t getJointCount() const =0
virtual StringView getGUIControlName(std::uint16_t index) const =0
Name of the requested GUI control.
virtual StringView getJointName(std::uint16_t index) const =0
Name of the requested joint.
virtual void clearMeshBlendShapeChannelMappings()=0
Delete all stored mesh to blend shape channel mapping entries.
virtual void clearMeshNames()=0
Delete all stored mesh names.
virtual void setBlendShapeChannelName(std::uint16_t index, const char *name)=0
Name of the specified blend shape channel.
virtual void setMeshBlendShapeChannelMapping(std::uint32_t index, std::uint16_t meshIndex, std::uint16_t blendShapeChannelIndex)=0
Associate a blend shape channel with it's mesh.
virtual void clearLODBlendShapeChannelMappings()=0
Delete all stored LOD to blend shape channel list index mapping entries.
virtual void setMeshName(std::uint16_t index, const char *name)=0
Name of the specified mesh.
virtual void setNeutralJointRotations(const Vector3 *rotations, std::uint16_t count)=0
virtual void clearLODMeshMappings()=0
Delete all stored LOD to mesh list index mapping entries.
virtual void clearGUIControlNames()=0
Delete all stored GUI control names.
virtual void setRawControlName(std::uint16_t index, const char *name)=0
Name of the specified raw control.
virtual void clearJointNames()=0
Delete all stored joint names.
virtual void setJointHierarchy(const std::uint16_t *jointIndices, std::uint16_t count)=0
A simple array describing the parent-child relationships between joints.
virtual void clearBlendShapeChannelIndices()=0
Delete all stored blend shape channel indices.
virtual void clearAnimatedMapIndices()=0
Delete all stored animated map indices.
virtual void setAnimatedMapName(std::uint16_t index, const char *name)=0
Name of the specified animated map.
virtual void clearMeshIndices()=0
Delete all stored mesh indices.
virtual void clearBlendShapeChannelNames()=0
Delete all stored blend shape channel names.
virtual void setJointName(std::uint16_t index, const char *name)=0
Name of the specified joint.
virtual void clearRawControlNames()=0
Delete all stored raw control names.
virtual void setGUIControlName(std::uint16_t index, const char *name)=0
Name of the specified GUI control.
virtual void clearLODJointMappings()=0
Delete all stored LOD to joint list index mapping entries.
virtual void clearLODAnimatedMapMappings()=0
Delete all stored LOD to animated map list index mapping entries.
virtual void clearJointIndices()=0
Delete all stored joint indices.
virtual void setNeutralJointTranslations(const Vector3 *translations, std::uint16_t count)=0
virtual void clearAnimatedMapNames()=0
Delete all stored animated map names.
virtual std::uint16_t getLODCount() const =0
Available levels of detail (e.g. 6 which means the following levels are available: [0,...
pointer data()
Definition: ArrayView.h:102
static void copyNameIndices(IndicesGetter getIndices, IndicesSetter setIndices, LODMappingSetter setLODMapping, std::uint16_t lodCount, MemoryResource *memRes)
Definition: Writer.cpp:82

References dna::DefinitionWriter::clearAnimatedMapIndices(), dna::DefinitionWriter::clearAnimatedMapNames(), dna::DefinitionWriter::clearBlendShapeChannelIndices(), dna::DefinitionWriter::clearBlendShapeChannelNames(), dna::DefinitionWriter::clearGUIControlNames(), dna::DefinitionWriter::clearJointIndices(), dna::DefinitionWriter::clearJointNames(), dna::DefinitionWriter::clearLODAnimatedMapMappings(), dna::DefinitionWriter::clearLODBlendShapeChannelMappings(), dna::DefinitionWriter::clearLODJointMappings(), dna::DefinitionWriter::clearLODMeshMappings(), dna::DefinitionWriter::clearMeshBlendShapeChannelMappings(), dna::DefinitionWriter::clearMeshIndices(), dna::DefinitionWriter::clearMeshNames(), dna::DefinitionWriter::clearRawControlNames(), copyNameIndices(), trust::ArrayView< T >::data(), dna::DefinitionReader::getAnimatedMapCount(), dna::DefinitionReader::getAnimatedMapIndicesForLOD(), dna::DefinitionReader::getAnimatedMapName(), dna::DefinitionReader::getBlendShapeChannelCount(), dna::DefinitionReader::getBlendShapeChannelIndicesForLOD(), dna::DefinitionReader::getBlendShapeChannelName(), dna::DefinitionReader::getGUIControlCount(), dna::DefinitionReader::getGUIControlName(), dna::DefinitionReader::getJointCount(), dna::DefinitionReader::getJointIndicesForLOD(), dna::DefinitionReader::getJointName(), dna::DefinitionReader::getJointParentIndex(), dna::DescriptorReader::getLODCount(), dna::DefinitionReader::getMeshBlendShapeChannelMapping(), dna::DefinitionReader::getMeshBlendShapeChannelMappingCount(), dna::DefinitionReader::getMeshCount(), dna::DefinitionReader::getMeshIndicesForLOD(), dna::DefinitionReader::getMeshName(), dna::DefinitionReader::getNeutralJointRotation(), dna::DefinitionReader::getNeutralJointTranslation(), dna::DefinitionReader::getRawControlCount(), dna::DefinitionReader::getRawControlName(), dna::DefinitionWriter::setAnimatedMapIndices(), dna::DefinitionWriter::setAnimatedMapName(), dna::DefinitionWriter::setBlendShapeChannelIndices(), dna::DefinitionWriter::setBlendShapeChannelName(), dna::DefinitionWriter::setGUIControlName(), dna::DefinitionWriter::setJointHierarchy(), dna::DefinitionWriter::setJointIndices(), dna::DefinitionWriter::setJointName(), dna::DefinitionWriter::setLODAnimatedMapMapping(), dna::DefinitionWriter::setLODBlendShapeChannelMapping(), dna::DefinitionWriter::setLODJointMapping(), dna::DefinitionWriter::setLODMeshMapping(), dna::DefinitionWriter::setMeshBlendShapeChannelMapping(), dna::DefinitionWriter::setMeshIndices(), dna::DefinitionWriter::setMeshName(), dna::DefinitionWriter::setNeutralJointRotations(), dna::DefinitionWriter::setNeutralJointTranslations(), and dna::DefinitionWriter::setRawControlName().

Referenced by dna::Writer::setFrom().

◆ copyDescriptor()

static void dna::copyDescriptor ( const DescriptorReader source,
DescriptorWriter destination,
MemoryResource  
)
static
45 {
46 destination->setName(source->getName());
47 destination->setArchetype(source->getArchetype());
48 destination->setGender(source->getGender());
49 destination->setAge(source->getAge());
50 destination->clearMetaData();
51 for (std::uint32_t i = 0u; i < source->getMetaDataCount(); ++i) {
52 const auto key = source->getMetaDataKey(i);
53 const auto value = source->getMetaDataValue(key);
54 destination->setMetaData(key, value);
55 }
56 destination->setTranslationUnit(source->getTranslationUnit());
57 destination->setRotationUnit(source->getRotationUnit());
58 destination->setCoordinateSystem(source->getCoordinateSystem());
59 destination->setLODCount(source->getLODCount());
60 destination->setDBMaxLOD(source->getDBMaxLOD());
61 destination->setDBComplexity(source->getDBComplexity());
62 destination->setDBName(source->getDBName());
63}
virtual StringView getMetaDataValue(const char *key) const =0
Stored metadata value associated with the given key.
virtual std::uint16_t getDBMaxLOD() const =0
The maximum level of detail stored in the DNA data for this character.
virtual Archetype getArchetype() const =0
virtual StringView getName() const =0
virtual StringView getDBComplexity() const =0
Name of the input control interface used to drive this character rig.
virtual StringView getDBName() const =0
Name of the database from which the character originates.
virtual std::uint32_t getMetaDataCount() const =0
virtual RotationUnit getRotationUnit() const =0
virtual TranslationUnit getTranslationUnit() const =0
virtual StringView getMetaDataKey(std::uint32_t index) const =0
virtual std::uint16_t getAge() const =0
virtual Gender getGender() const =0
virtual CoordinateSystem getCoordinateSystem() const =0
virtual void setMetaData(const char *key, const char *value)=0
Associate the metadata value with the given key.
virtual void setCoordinateSystem(CoordinateSystem system)=0
virtual void setRotationUnit(RotationUnit unit)=0
virtual void setLODCount(std::uint16_t lodCount)=0
Available levels of detail (e.g. 6 which means the following levels are available: [0,...
virtual void setAge(std::uint16_t age)=0
virtual void setDBMaxLOD(std::uint16_t lod)=0
The maximum level of detail stored in the DNA data for this character.
virtual void setGender(Gender gender)=0
virtual void setName(const char *name)=0
virtual void setTranslationUnit(TranslationUnit unit)=0
virtual void setDBComplexity(const char *name)=0
Name of the input control interface used to drive this character rig.
virtual void setDBName(const char *name)=0
Name of the database from which the character originates.
virtual void clearMetaData()=0
Empties the metadata storage, delete all key-value pairs.
virtual void setArchetype(Archetype archetype)=0

References dna::DescriptorWriter::clearMetaData(), dna::DescriptorReader::getAge(), dna::DescriptorReader::getArchetype(), dna::DescriptorReader::getCoordinateSystem(), dna::DescriptorReader::getDBComplexity(), dna::DescriptorReader::getDBMaxLOD(), dna::DescriptorReader::getDBName(), dna::DescriptorReader::getGender(), dna::DescriptorReader::getLODCount(), dna::DescriptorReader::getMetaDataCount(), dna::DescriptorReader::getMetaDataKey(), dna::DescriptorReader::getMetaDataValue(), dna::DescriptorReader::getName(), dna::DescriptorReader::getRotationUnit(), dna::DescriptorReader::getTranslationUnit(), dna::DescriptorWriter::setAge(), dna::DescriptorWriter::setArchetype(), dna::DescriptorWriter::setCoordinateSystem(), dna::DescriptorWriter::setDBComplexity(), dna::DescriptorWriter::setDBMaxLOD(), dna::DescriptorWriter::setDBName(), dna::DescriptorWriter::setGender(), dna::DescriptorWriter::setLODCount(), dna::DescriptorWriter::setMetaData(), dna::DescriptorWriter::setName(), dna::DescriptorWriter::setRotationUnit(), and dna::DescriptorWriter::setTranslationUnit().

Referenced by dna::Writer::setFrom().

◆ copyGeometry()

static void dna::copyGeometry ( const GeometryReader source,
GeometryWriter destination,
MemoryResource memRes 
)
static
315 {
316 destination->clearMeshes();
317
318 if (!hasGeometry(source)) {
319 // Source DNA was loaded without geometry layer
320 return;
321 }
322
323 for (std::uint16_t meshIndexPlusOne = source->getMeshCount(); meshIndexPlusOne > 0u; --meshIndexPlusOne) {
324 const auto meshIndex = static_cast<std::uint16_t>(meshIndexPlusOne - 1u);
325 auto vertexCount = source->getVertexPositionCount(meshIndex);
326 auto positions = collect_n<Vector3Vector>(vertexCount, [source, meshIndex](std::size_t index) {
327 return source->getVertexPosition(meshIndex, static_cast<std::uint32_t>(index));
328 }, memRes);
329 destination->setVertexPositions(meshIndex, positions.data(), static_cast<std::uint32_t>(positions.size()));
330
331 auto textureCoordinateCount = source->getVertexTextureCoordinateCount(meshIndex);
332 auto textureCoordinates = collect_n<TextureCoordinateVector>(textureCoordinateCount,
333 [source, meshIndex](std::size_t index) {
334 return source->getVertexTextureCoordinate(meshIndex, static_cast<std::uint32_t>(index));
335 }, memRes);
336 destination->setVertexTextureCoordinates(meshIndex, textureCoordinates.data(),
337 static_cast<std::uint32_t>(textureCoordinates.size()));
338
339 auto normalCount = source->getVertexNormalCount(meshIndex);
340 auto normals = collect_n<Vector3Vector>(normalCount, [source, meshIndex](std::size_t index) {
341 return source->getVertexNormal(meshIndex, static_cast<std::uint32_t>(index));
342 }, memRes);
343 destination->setVertexNormals(meshIndex, normals.data(), static_cast<std::uint32_t>(normals.size()));
344
345 auto layoutCount = source->getVertexLayoutCount(meshIndex);
346 auto layouts = collect_n<VertexLayoutVector>(layoutCount, [source, meshIndex](std::size_t index) {
347 return source->getVertexLayout(meshIndex, static_cast<std::uint32_t>(index));
348 }, memRes);
349 destination->setVertexLayouts(meshIndex, layouts.data(), static_cast<std::uint32_t>(layouts.size()));
350
351 for (std::uint32_t faceIndexPlusOne = source->getFaceCount(meshIndex); faceIndexPlusOne > 0u; --faceIndexPlusOne) {
352 const auto faceIndex = faceIndexPlusOne - 1u;
353 auto faceVertices = source->getFaceVertexLayoutIndices(meshIndex, faceIndex);
354 destination->setFaceVertexLayoutIndices(meshIndex, faceIndex, faceVertices.data(),
355 static_cast<std::uint32_t>(faceVertices.size()));
356 }
357
358 destination->setMaximumInfluencePerVertex(meshIndex, source->getMaximumInfluencePerVertex(meshIndex));
359
360 const auto skinWeightsCount = source->getSkinWeightsCount(meshIndex);
361 for (std::uint32_t skinWeightsIndexPlusOne = skinWeightsCount; skinWeightsIndexPlusOne > 0u; --skinWeightsIndexPlusOne) {
362 const auto skinWeightsIndex = skinWeightsIndexPlusOne - 1u;
363 auto skinWeights = source->getSkinWeightsValues(meshIndex, skinWeightsIndex);
364 destination->setSkinWeightsValues(meshIndex, skinWeightsIndex, skinWeights.data(),
365 static_cast<std::uint16_t>(skinWeights.size()));
366
367 auto skinWeightsJoints = source->getSkinWeightsJointIndices(meshIndex, skinWeightsIndex);
368 destination->setSkinWeightsJointIndices(meshIndex, skinWeightsIndex, skinWeightsJoints.data(),
369 static_cast<std::uint16_t>(skinWeightsJoints.size()));
370 }
371 }
372}
virtual std::uint32_t getVertexNormalCount(std::uint16_t meshIndex) const =0
Number of vertex normals in the entire mesh.
virtual Position getVertexPosition(std::uint16_t meshIndex, std::uint32_t vertexIndex) const =0
virtual ConstArrayView< float > getSkinWeightsValues(std::uint16_t meshIndex, std::uint32_t vertexIndex) const =0
List of skin weights influencing the requested vertex.
virtual std::uint32_t getVertexLayoutCount(std::uint16_t meshIndex) const =0
Number of vertex layouts in the entire mesh.
virtual std::uint32_t getSkinWeightsCount(std::uint16_t meshIndex) const =0
Number of skin weights associated with the specified mesh.
virtual TextureCoordinate getVertexTextureCoordinate(std::uint16_t meshIndex, std::uint32_t textureCoordinateIndex) const =0
virtual Normal getVertexNormal(std::uint16_t meshIndex, std::uint32_t normalIndex) const =0
virtual VertexLayout getVertexLayout(std::uint16_t meshIndex, std::uint32_t layoutIndex) const =0
Vertex layouts contain only attribute indices which can be used to query the actual attributes,...
virtual std::uint16_t getMaximumInfluencePerVertex(std::uint16_t meshIndex) const =0
The maximum number of joints that may influence any single vertex.
virtual std::uint32_t getVertexTextureCoordinateCount(std::uint16_t meshIndex) const =0
Number of texture coordinates in the entire mesh.
virtual ConstArrayView< std::uint32_t > getFaceVertexLayoutIndices(std::uint16_t meshIndex, std::uint32_t faceIndex) const =0
List of vertex layout indices the belong to a face on the specified mesh.
virtual std::uint32_t getFaceCount(std::uint16_t meshIndex) const =0
Number of faces that belong to the specified mesh.
virtual std::uint32_t getVertexPositionCount(std::uint16_t meshIndex) const =0
Number of vertex positions in the entire mesh.
virtual ConstArrayView< std::uint16_t > getSkinWeightsJointIndices(std::uint16_t meshIndex, std::uint32_t vertexIndex) const =0
List of joint indices associated with each skin weight for the specified vertex.
virtual void setFaceVertexLayoutIndices(std::uint16_t meshIndex, std::uint32_t faceIndex, const std::uint32_t *layoutIndices, std::uint32_t count)=0
Vertex layout indices that belong to the specified face.
virtual void setSkinWeightsJointIndices(std::uint16_t meshIndex, std::uint32_t vertexIndex, const std::uint16_t *jointIndices, std::uint16_t count)=0
List of joint indices associated with each skin weight for the specified vertex.
virtual void clearMeshes()=0
Delete all meshes.
virtual void setVertexTextureCoordinates(std::uint16_t meshIndex, const TextureCoordinate *textureCoordinates, std::uint32_t count)=0
List of vertex texture coordinates.
virtual void setVertexLayouts(std::uint16_t meshIndex, const VertexLayout *layouts, std::uint32_t count)=0
List of vertex layouts the belong to the specified mesh.
virtual void setVertexNormals(std::uint16_t meshIndex, const Normal *normals, std::uint32_t count)=0
List of vertex normals.
virtual void setSkinWeightsValues(std::uint16_t meshIndex, std::uint32_t vertexIndex, const float *weights, std::uint16_t count)=0
List of skin weights influencing the referenced vertex.
virtual void setMaximumInfluencePerVertex(std::uint16_t meshIndex, std::uint16_t maxInfluenceCount)=0
virtual void setVertexPositions(std::uint16_t meshIndex, const Position *positions, std::uint32_t count)=0
List of vertex positions.
static bool hasGeometry(const GeometryReader *source)
Definition: Writer.cpp:296

References dna::GeometryWriter::clearMeshes(), dna::GeometryReader::getFaceCount(), dna::GeometryReader::getFaceVertexLayoutIndices(), dna::GeometryReader::getMaximumInfluencePerVertex(), dna::DefinitionReader::getMeshCount(), dna::GeometryReader::getSkinWeightsCount(), dna::GeometryReader::getSkinWeightsJointIndices(), dna::GeometryReader::getSkinWeightsValues(), dna::GeometryReader::getVertexLayout(), dna::GeometryReader::getVertexLayoutCount(), dna::GeometryReader::getVertexNormal(), dna::GeometryReader::getVertexNormalCount(), dna::GeometryReader::getVertexPosition(), dna::GeometryReader::getVertexPositionCount(), dna::GeometryReader::getVertexTextureCoordinate(), dna::GeometryReader::getVertexTextureCoordinateCount(), hasGeometry(), dna::GeometryWriter::setFaceVertexLayoutIndices(), dna::GeometryWriter::setMaximumInfluencePerVertex(), dna::GeometryWriter::setSkinWeightsJointIndices(), dna::GeometryWriter::setSkinWeightsValues(), dna::GeometryWriter::setVertexLayouts(), dna::GeometryWriter::setVertexNormals(), dna::GeometryWriter::setVertexPositions(), and dna::GeometryWriter::setVertexTextureCoordinates().

Referenced by dna::Writer::setFrom().

◆ copyNameIndices()

static void dna::copyNameIndices ( IndicesGetter  getIndices,
IndicesSetter  setIndices,
LODMappingSetter  setLODMapping,
std::uint16_t  lodCount,
MemoryResource memRes 
)
static
86 {
87 Matrix<std::uint16_t> allIndices{memRes};
88 std::uint16_t index = 0u;
89 for (std::uint16_t lod = 0u; lod < lodCount; ++lod) {
90 auto indices = getIndices(lod);
91 // Check if these same indices were perhaps already used for previous LODs
92 auto found = findIndices(allIndices, indices);
93 if (!found.first) {
94 setIndices(index, indices.data(), static_cast<std::uint16_t>(indices.size()));
95 setLODMapping(lod, index);
96 allIndices.emplace_back(indices.begin(), indices.end());
97 ++index;
98 } else {
99 // Already used so do not replicate the same data twice
100 setLODMapping(lod, found.second);
101 }
102 }
103}
static std::pair< bool, std::uint16_t > findIndices(const Matrix< std::uint16_t > &source, ConstArrayView< std::uint16_t > indices)
Definition: Writer.cpp:65
Vector< Vector< T >, Allocator > Matrix
Definition: include/pma/TypeDefs.h:32

References findIndices().

Referenced by copyDefinition().

◆ ensureHasSize()

template<class TContainer , typename ... Args>
void dna::ensureHasSize ( TContainer &  target,
std::size_t  size,
Args &&...  args 
)

◆ findIndices()

static std::pair< bool, std::uint16_t > dna::findIndices ( const Matrix< std::uint16_t > &  source,
ConstArrayView< std::uint16_t >  indices 
)
static
65 {
66 // In the common scenario each LOD has it's unique set of indices
67 for (std::size_t i = 0ul; i < source.size(); ++i) {
68 ConstArrayView<std::uint16_t> candidate{source[i].data(), source[i].size()};
69 if (indices == candidate) {
70 // Unless the indices are the same between multiple LODs, in which case use the
71 // already registered index
72 return {true, static_cast<std::uint16_t>(i)};
73 }
74 }
75 return {false, static_cast<std::uint16_t>(0)};
76}
A view over a continuous sequence of objects.
Definition: ArrayView.h:55

References trust::ArrayView< T >::data().

Referenced by copyNameIndices().

◆ hasBlendShapeTargets()

static bool dna::hasBlendShapeTargets ( const GeometryReader source)
static
374 {
375 // Heuristic for determining whether source DNA actually has any blend shape target data, or mesh count is non-zero only
376 // because of mesh names stored in definition layer
377 std::uint32_t totalBlendShapeTargetCount = {};
378 for (std::uint16_t meshIndex = {}; meshIndex < source->getMeshCount(); ++meshIndex) {
379 totalBlendShapeTargetCount += source->getBlendShapeTargetCount(meshIndex);
380 }
381 return (totalBlendShapeTargetCount != 0u);
382}

References dna::GeometryReader::getBlendShapeTargetCount(), and dna::DefinitionReader::getMeshCount().

Referenced by copyBlendShapeTargets().

◆ hasGeometry()

static bool dna::hasGeometry ( const GeometryReader source)
static
296 {
297 // Heuristic for determining whether source DNA actually has any geometry data, or mesh count is non-zero only
298 // because of mesh names stored in definition layer
299 std::uint32_t totalVertexCount = {};
300 std::uint32_t totalVertexNormalCount = {};
301 std::uint32_t totalTextureCoordCount = {};
302 std::uint32_t totalVertexLayoutCount = {};
303 std::uint32_t totalSkinWeightCount = {};
304 for (std::uint16_t meshIndex = {}; meshIndex < source->getMeshCount(); ++meshIndex) {
305 totalVertexCount += source->getVertexPositionCount(meshIndex);
306 totalVertexNormalCount += source->getVertexNormalCount(meshIndex);
307 totalTextureCoordCount += source->getVertexTextureCoordinateCount(meshIndex);
308 totalVertexLayoutCount += source->getVertexLayoutCount(meshIndex);
309 totalSkinWeightCount += source->getSkinWeightsCount(meshIndex);
310 }
311 return ((totalVertexCount != 0u) || (totalVertexNormalCount != 0u) || (totalTextureCoordCount != 0u) ||
312 (totalVertexLayoutCount != 0u) || (totalSkinWeightCount != 0u));
313}

References dna::DefinitionReader::getMeshCount(), dna::GeometryReader::getSkinWeightsCount(), dna::GeometryReader::getVertexLayoutCount(), dna::GeometryReader::getVertexNormalCount(), dna::GeometryReader::getVertexPositionCount(), and dna::GeometryReader::getVertexTextureCoordinateCount().

Referenced by copyGeometry().

◆ operator!=() [1/2]

bool dna::operator!= ( const StringView lhs,
const StringView rhs 
)
inline
39 {
40 return !(lhs == rhs);
41}

◆ operator!=() [2/2]

bool dna::operator!= ( const Vector3 lhs,
const Vector3 rhs 
)
inline
106 {
107 return !(lhs == rhs);
108}

◆ operator&()

template<typename TEnum >
std::enable_if< std::is_enum< TEnum >::value, TEnum >::type dna::operator& ( TEnum  lhs,
TEnum  rhs 
)
11 {
12 using Underlying = typename std::underlying_type<TEnum>::type;
13 return static_cast<TEnum>(static_cast<Underlying>(lhs) & static_cast<Underlying>(rhs));
14}

◆ operator&=()

template<typename TEnum >
std::enable_if< std::is_enum< TEnum >::value, TEnum >::type dna::operator&= ( TEnum &  lhs,
TEnum  rhs 
)
39 {
40 return lhs = (lhs & rhs);
41}

◆ operator*() [1/2]

Vector3 dna::operator* ( Vector3  lhs,
const Vector3 rhs 
)
inline
78 {
79 return (lhs *= rhs);
80}

◆ operator*() [2/2]

Vector3 dna::operator* ( Vector3  lhs,
float  rhs 
)
inline
94 {
95 return (lhs *= rhs);
96}

◆ operator+() [1/2]

Vector3 dna::operator+ ( Vector3  lhs,
const Vector3 rhs 
)
inline
70 {
71 return (lhs += rhs);
72}

◆ operator+() [2/2]

Vector3 dna::operator+ ( Vector3  lhs,
float  rhs 
)
inline
86 {
87 return (lhs += rhs);
88}

◆ operator-() [1/2]

Vector3 dna::operator- ( Vector3  lhs,
const Vector3 rhs 
)
inline
74 {
75 return (lhs -= rhs);
76}

◆ operator-() [2/2]

Vector3 dna::operator- ( Vector3  lhs,
float  rhs 
)
inline
90 {
91 return (lhs -= rhs);
92}

◆ operator/() [1/2]

Vector3 dna::operator/ ( Vector3  lhs,
const Vector3 rhs 
)
inline
82 {
83 return (lhs /= rhs);
84}

◆ operator/() [2/2]

Vector3 dna::operator/ ( Vector3  lhs,
float  rhs 
)
inline
98 {
99 return (lhs /= rhs);
100}

◆ operator==() [1/2]

bool dna::operator== ( const StringView lhs,
const StringView rhs 
)
inline
35 {
36 return (static_cast<const StringView::Base&>(lhs) == static_cast<const StringView::Base&>(rhs));
37}

◆ operator==() [2/2]

bool dna::operator== ( const Vector3 lhs,
const Vector3 rhs 
)
inline
102 {
103 return (lhs.x == rhs.x && lhs.y == rhs.y && lhs.z == rhs.z);
104}
float x
Definition: Vector3.h:8
float z
Definition: Vector3.h:10
float y
Definition: Vector3.h:9

References dna::Vector3::x, dna::Vector3::y, and dna::Vector3::z.

◆ operator^()

template<typename TEnum >
std::enable_if< std::is_enum< TEnum >::value, TEnum >::type dna::operator^ ( TEnum  lhs,
TEnum  rhs 
)
25 {
26 using Underlying = typename std::underlying_type<TEnum>::type;
27 return static_cast<TEnum>(static_cast<Underlying>(lhs) ^ static_cast<Underlying>(rhs));
28}

◆ operator^=()

template<typename TEnum >
std::enable_if< std::is_enum< TEnum >::value, TEnum >::type dna::operator^= ( TEnum &  lhs,
TEnum  rhs 
)
51 {
52 return lhs = (lhs ^ rhs);
53}

◆ operator|()

template<typename TEnum >
std::enable_if< std::is_enum< TEnum >::value, TEnum >::type dna::operator| ( TEnum  lhs,
TEnum  rhs 
)
18 {
19 using Underlying = typename std::underlying_type<TEnum>::type;
20 return static_cast<TEnum>(static_cast<Underlying>(lhs) | static_cast<Underlying>(rhs));
21}

◆ operator|=()

template<typename TEnum >
std::enable_if< std::is_enum< TEnum >::value, TEnum >::type dna::operator|= ( TEnum &  lhs,
TEnum  rhs 
)
45 {
46 return lhs = (lhs | rhs);
47}

◆ operator~()

template<typename TEnum >
std::enable_if< std::is_enum< TEnum >::value, TEnum >::type dna::operator~ ( TEnum  value)
32 {
33 using Underlying = typename std::underlying_type<TEnum>::type;
34 return static_cast<TEnum>(~static_cast<Underlying>(value));
35}

◆ remap()

template<typename T >
void dna::remap ( originalCount,
const UnorderedSet< T > &  keptIndices,
UnorderedMap< T, T > &  mapping 
)
inline
11 {
12 for (T oldIndex{}, newIndex{}; oldIndex < originalCount; ++oldIndex) {
13 if (extd::contains(keptIndices, oldIndex)) {
14 mapping.insert({oldIndex, newIndex});
15 ++newIndex;
16 }
17 }
18}
bool contains(TInputIterator first, TInputIterator last, const T &value)
Definition: utils/Extd.h:40

References extd::contains().

Referenced by dna::AnimatedMapFilter::configure(), dna::BlendShapeFilter::configure(), dna::JointFilter::configure(), and dna::MeshFilter::configure().

◆ remappedPositions()

template<typename T , typename U >
static UnorderedMap< U, U > dna::remappedPositions ( const Vector< T > &  target,
const UnorderedSet< U > &  indices,
MemoryResource memRes 
)
static
27 {
28 UnorderedMap<U, U> mapping{memRes};
29 for (U oldIndex{}, newIndex{}; oldIndex < static_cast<U>(target.size()); ++oldIndex) {
30 if (indices.find(oldIndex) != indices.end()) {
31 mapping.insert({oldIndex, newIndex});
32 ++newIndex;
33 }
34 }
35 return mapping;
36}
std::unordered_map< K, V, std::hash< K >, std::equal_to< K >, Allocator > UnorderedMap
Definition: include/pma/TypeDefs.h:47

Variable Documentation

◆ jointAttributeCount

constexpr std::uint16_t dna::jointAttributeCount = 9u
staticconstexpr