This commit is contained in:
Lynix 2019-01-19 02:17:21 +01:00
commit bc625b5c8b
4 changed files with 9 additions and 7 deletions

View File

@ -19,10 +19,11 @@ namespace Ndk
class NDK_API VelocityComponent : public Component<VelocityComponent>
{
public:
VelocityComponent(const Nz::Vector3f& velocity = Nz::Vector3f::Zero());
VelocityComponent(const Nz::Vector3f& velocity = Nz::Vector3f::Zero(), Nz::CoordSys coordSystem = Nz::CoordSys_Global);
~VelocityComponent() = default;
Nz::Vector3f linearVelocity;
Nz::CoordSys coordSys;
VelocityComponent& operator=(const Nz::Vector3f& vel);

View File

@ -16,8 +16,9 @@ namespace Ndk
* \param velocity Linear velocity
*/
inline VelocityComponent::VelocityComponent(const Nz::Vector3f& velocity) :
linearVelocity(velocity)
inline VelocityComponent::VelocityComponent(const Nz::Vector3f& velocity, Nz::CoordSys coordSystem) :
linearVelocity(velocity),
coordSys(coordSystem)
{
}

View File

@ -43,7 +43,7 @@ namespace Ndk
NodeComponent& node = entity->GetComponent<NodeComponent>();
const VelocityComponent& velocity = entity->GetComponent<VelocityComponent>();
node.Move(velocity.linearVelocity * elapsedTime, Nz::CoordSys_Global);
node.Move(velocity.linearVelocity * elapsedTime, velocity.coordSys);
}
}

View File

@ -37,13 +37,13 @@ namespace Nz
{
const UnicodeCharacter* GetCharacter(Nz::UInt32 codepoint)
{
auto it = std::lower_bound(std::begin(unicodeCharacters), std::end(unicodeCharacters), codepoint, [](const UnicodeCharacter& character, Nz::UInt32 codepoint) { return character.codepoint < codepoint; });
auto it = std::lower_bound(std::begin(unicodeCharacters), std::end(unicodeCharacters), codepoint, [](const UnicodeCharacter& character, Nz::UInt32 otherCodepoint) { return character.codepoint < otherCodepoint; });
if (it != std::end(unicodeCharacters) && it->codepoint == codepoint)
return &*it;
else
{
// Character is not part of the common character array, search in set
auto itSet = std::lower_bound(std::begin(unicodeSets), std::end(unicodeSets), codepoint, [](const UnicodeSet& character, Nz::UInt32 codepoint) { return character.firstCodepoint < codepoint; });
auto itSet = std::lower_bound(std::begin(unicodeSets), std::end(unicodeSets), codepoint, [](const UnicodeSet& character, Nz::UInt32 otherCodepoint) { return character.firstCodepoint < otherCodepoint; });
if (itSet != std::begin(unicodeSets))
{
--itSet;
@ -58,7 +58,7 @@ namespace Nz
template<std::size_t N>
const UnicodeCharacterSimpleMapping* GetCharacterMapping(Nz::UInt32 codepoint, const UnicodeCharacterSimpleMapping(&mapping)[N])
{
auto it = std::lower_bound(std::begin(mapping), std::end(mapping), codepoint, [](const UnicodeCharacterSimpleMapping& character, Nz::UInt32 codepoint) { return character.codepoint < codepoint; });
auto it = std::lower_bound(std::begin(mapping), std::end(mapping), codepoint, [](const UnicodeCharacterSimpleMapping& character, Nz::UInt32 otherCodepoint) { return character.codepoint < otherCodepoint; });
if (it != std::end(mapping) && it->codepoint == codepoint)
return &*it;
else