SetSkinWeightsCommand.cpp dnacalib/commands/SetSkinWeightsCommand.h dnacalib/CommandImplBase.h dnacalib/dna/DNA.h dnacalib/dna/DNACalibDNAReaderImpl.h dnacalib/types/Aliases.h dnac::SetSkinWeightsCommand::Impl dnac //CopyrightEpicGames,Inc.AllRightsReserved. #include"dnacalib/commands/SetSkinWeightsCommand.h" #include"dnacalib/CommandImplBase.h" #include"dnacalib/dna/DNA.h" #include"dnacalib/dna/DNACalibDNAReaderImpl.h" #include"dnacalib/types/Aliases.h" namespacednac{ classSetSkinWeightsCommand::Impl:publicCommandImplBase<Impl>{ private: usingSuper=CommandImplBase<Impl>; public: explicitImpl(MemoryResource*memRes_): Super{memRes_}, weights{memRes_}, jointIndices{memRes_}, meshIndex{}, vertexIndex{}{ } voidsetMeshIndex(std::uint16_tmeshIndex_){ meshIndex=meshIndex_; } voidsetVertexIndex(std::uint32_tvertexIndex_){ vertexIndex=vertexIndex_; } voidsetWeights(ConstArrayView<float>weights_){ weights.assign(weights_.begin(),weights_.end()); } voidsetJointIndices(ConstArrayView<std::uint16_t>jointIndices_){ jointIndices.assign(jointIndices_.begin(),jointIndices_.end()); } voidrun(DNACalibDNAReaderImpl*output){ output->setSkinWeightsValues(meshIndex,vertexIndex,weights.data(),static_cast<std::uint16_t>(weights.size())); output->setSkinWeightsJointIndices(meshIndex,vertexIndex,jointIndices.data(), static_cast<std::uint16_t>(jointIndices.size())); } private: Vector<float>weights; Vector<std::uint16_t>jointIndices; std::uint16_tmeshIndex; std::uint32_tvertexIndex; }; SetSkinWeightsCommand::SetSkinWeightsCommand(MemoryResource*memRes):pImpl{makeScoped<Impl>(memRes)}{ } SetSkinWeightsCommand::SetSkinWeightsCommand(std::uint16_tmeshIndex, std::uint32_tvertexIndex, ConstArrayView<float>weights, ConstArrayView<std::uint16_t>jointIndices, MemoryResource*memRes): pImpl{makeScoped<Impl>(memRes)}{ pImpl->setMeshIndex(meshIndex); pImpl->setVertexIndex(vertexIndex); pImpl->setWeights(weights); pImpl->setJointIndices(jointIndices); } SetSkinWeightsCommand::~SetSkinWeightsCommand()=default; SetSkinWeightsCommand::SetSkinWeightsCommand(SetSkinWeightsCommand&&)=default; SetSkinWeightsCommand&SetSkinWeightsCommand::operator=(SetSkinWeightsCommand&&)=default; voidSetSkinWeightsCommand::setMeshIndex(std::uint16_tmeshIndex){ pImpl->setMeshIndex(meshIndex); } voidSetSkinWeightsCommand::setVertexIndex(std::uint32_tvertexIndex){ pImpl->setVertexIndex(vertexIndex); } voidSetSkinWeightsCommand::setWeights(ConstArrayView<float>weights){ pImpl->setWeights(weights); } voidSetSkinWeightsCommand::setJointIndices(ConstArrayView<std::uint16_t>jointIndices){ pImpl->setJointIndices(jointIndices); } voidSetSkinWeightsCommand::run(DNACalibDNAReader*output){ pImpl->run(static_cast<DNACalibDNAReaderImpl*>(output)); } }//namespacednac