mirror of
https://github.com/minetest/irrlicht.git
synced 2024-11-14 06:20:26 +01:00
2bf1d12353
find -type f | # list all regular files grep -E '\.(h|cpp|mm)$' | # filter for source files grep -v '/mt_' | # filter out generated files grep -v '/vendor/' | # and vendored GL grep -v '/test/image_loader_test.cpp' | # and this file (has giant literals arrays) xargs -n 1 -P $(nproc) clang-format -i # reformat everything Co-authored-by: numzero <numzer0@yandex.ru>
90 lines
2.0 KiB
C++
90 lines
2.0 KiB
C++
// Copyright (C) 2002-2012 Nikolaus Gebhardt
|
|
// This file is part of the "Irrlicht Engine".
|
|
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
|
|
|
#include "CBoneSceneNode.h"
|
|
|
|
#include <optional>
|
|
|
|
namespace irr
|
|
{
|
|
namespace scene
|
|
{
|
|
|
|
//! constructor
|
|
CBoneSceneNode::CBoneSceneNode(ISceneNode *parent, ISceneManager *mgr, s32 id,
|
|
u32 boneIndex, const std::optional<std::string> &boneName) :
|
|
IBoneSceneNode(parent, mgr, id),
|
|
BoneIndex(boneIndex),
|
|
AnimationMode(EBAM_AUTOMATIC), SkinningSpace(EBSS_LOCAL)
|
|
{
|
|
#ifdef _DEBUG
|
|
setDebugName("CBoneSceneNode");
|
|
#endif
|
|
setName(boneName);
|
|
}
|
|
|
|
//! Returns the index of the bone
|
|
u32 CBoneSceneNode::getBoneIndex() const
|
|
{
|
|
return BoneIndex;
|
|
}
|
|
|
|
//! Sets the animation mode of the bone. Returns true if successful.
|
|
bool CBoneSceneNode::setAnimationMode(E_BONE_ANIMATION_MODE mode)
|
|
{
|
|
AnimationMode = mode;
|
|
return true;
|
|
}
|
|
|
|
//! Gets the current animation mode of the bone
|
|
E_BONE_ANIMATION_MODE CBoneSceneNode::getAnimationMode() const
|
|
{
|
|
return AnimationMode;
|
|
}
|
|
|
|
//! returns the axis aligned bounding box of this node
|
|
const core::aabbox3d<f32> &CBoneSceneNode::getBoundingBox() const
|
|
{
|
|
return Box;
|
|
}
|
|
|
|
/*
|
|
//! Returns the relative transformation of the scene node.
|
|
core::matrix4 CBoneSceneNode::getRelativeTransformation() const
|
|
{
|
|
return core::matrix4(); // RelativeTransformation;
|
|
}
|
|
*/
|
|
|
|
void CBoneSceneNode::OnAnimate(u32 timeMs)
|
|
{
|
|
if (IsVisible) {
|
|
// update absolute position
|
|
// updateAbsolutePosition();
|
|
|
|
// perform the post render process on all children
|
|
ISceneNodeList::iterator it = Children.begin();
|
|
for (; it != Children.end(); ++it)
|
|
(*it)->OnAnimate(timeMs);
|
|
}
|
|
}
|
|
|
|
void CBoneSceneNode::helper_updateAbsolutePositionOfAllChildren(ISceneNode *Node)
|
|
{
|
|
Node->updateAbsolutePosition();
|
|
|
|
ISceneNodeList::const_iterator it = Node->getChildren().begin();
|
|
for (; it != Node->getChildren().end(); ++it) {
|
|
helper_updateAbsolutePositionOfAllChildren((*it));
|
|
}
|
|
}
|
|
|
|
void CBoneSceneNode::updateAbsolutePositionOfAllChildren()
|
|
{
|
|
helper_updateAbsolutePositionOfAllChildren(this);
|
|
}
|
|
|
|
} // namespace scene
|
|
} // namespace irr
|