Implemented cylinder shape, also fixed the coordinate system (again). I fucking hate...
[fail.git] / scenegraph / Frame.cpp
blob24ed14fa17a7aeb2317c6f3bf28670e53c03752a
1 #include "Frame.h"
3 using namespace awful;
4 using namespace awful::scenegraph;
6 ConstPointer< Frame > Frame::ms_pBound;
8 void Frame::postLoad()
10 if( m_pParent )
12 m_pParent->m_Children.push_front( this );
13 m_itParentList = m_pParent->m_Children.begin();
17 void Frame::setpParent( const Pointer< Frame >& pParent )
19 if( m_pParent == pParent )
20 return;
22 detach();
24 m_pParent = pParent;
26 if( m_pParent )
28 m_pParent->m_Children.push_front( this );
29 m_itParentList = m_pParent->m_Children.begin();
32 dirty();
35 void Frame::markAsDirty() const
37 m_bDirty = true;
39 m_Dirty();
41 ChildrenList::const_iterator it;
42 for( it = m_Children.begin(); it != m_Children.end(); ++it )
43 ( *it )->dirty();
46 const math::Matrix44f& Frame::getLocalToWorld() const
48 if( !m_pParent )
50 m_bDirty = false;
51 return m_LocalToParent;
54 if( m_bDirty )
56 m_bDirty = false;
58 m_LocalToWorld = m_pParent->getLocalToWorld() * m_LocalToParent;
60 /*std::cout << "frame: local mtx is\n"
61 << m_LocalToParent.v1().x() << " " << m_LocalToParent.v1().y() << " " << m_LocalToParent.v1().z() << " " << m_LocalToParent.v1().w() << std::endl
62 << m_LocalToParent.v2().x() << " " << m_LocalToParent.v2().y() << " " << m_LocalToParent.v2().z() << " " << m_LocalToParent.v2().w() << std::endl
63 << m_LocalToParent.v3().x() << " " << m_LocalToParent.v3().y() << " " << m_LocalToParent.v3().z() << " " << m_LocalToParent.v3().w() << std::endl
64 << m_LocalToParent.v4().x() << " " << m_LocalToParent.v4().y() << " " << m_LocalToParent.v4().z() << " " << m_LocalToParent.v4().w() << std::endl;
67 std::cout << "frame: concatenating, local.x =" << m_LocalToParent.position().x()
68 << ", parent.x=" << m_pParent->getLocalToWorld().position().x()
69 << ", res.x=" << m_LocalToWorld.position().x() << std::endl;*/
72 //std::cout << "****\n";
74 return m_LocalToWorld;