• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            posts - 311, comments - 0, trackbacks - 0, articles - 0
              C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

            (地基工)OgreNode旋轉、位移

            Posted on 2011-04-27 16:54 點點滴滴 閱讀(542) 評論(0)  編輯 收藏 引用 所屬分類: 08 游戲SDK

             

              void Node::rotate(const Quaternion& q, TransformSpace relativeTo)
                {
                    
            // Normalise quaternion to avoid drift
                    Quaternion qnorm = q;
                    qnorm.normalise();

                    
            switch(relativeTo)
                    {
                    
            case TS_PARENT:
                        
            // Rotations are normally relative to local axes, transform up
                        mOrientation = qnorm * mOrientation;
                        
            break;
                    
            case TS_WORLD:
                        
            // Rotations are normally relative to local axes, transform up
                        mOrientation = mOrientation * _getDerivedOrientation().Inverse()
                            
            * qnorm * _getDerivedOrientation();
                        
            break;
                    
            case TS_LOCAL:
                        
            // Note the order of the mult, i.e. q comes after
                        mOrientation = mOrientation * qnorm;
                        
            break;
                    }
                    needUpdate();
                }
            旋轉是本地坐標旋轉

                //-----------------------------------------------------------------------
                void Node::translate(const Vector3& d, TransformSpace relativeTo)
                {
                    
            switch(relativeTo)
                    {
                    
            case TS_LOCAL:
                        
            // position is relative to parent so transform downwards
                        mPosition += mOrientation * d;
                        
            break;
                    
            case TS_WORLD:
                        
            // position is relative to parent so transform upwards
                        if (mParent)
                        {
                            mPosition 
            += (mParent->_getDerivedOrientation().Inverse() * d)
                                
            / mParent->_getDerivedScale();
                        }
                        
            else
                        {
                            mPosition 
            += d;
                        }
                        
            break;
                    
            case TS_PARENT:
                        mPosition 
            += d;
                        
            break;
                    }
                    needUpdate();

                }
            變換是相對于父坐標變換
            //-----------------------------------------------------------------------
                void Node::updateFromParentImpl(voidconst
                {
                    
            if (mParent)
                    {
                        
            // Update orientation
                        const Quaternion& parentOrientation = mParent->_getDerivedOrientation();
                        
            if (mInheritOrientation)
                        {
                            
            // Combine orientation with that of parent
                            mDerivedOrientation = parentOrientation * mOrientation;
                        }
                        
            else
                        {
                            
            // No inheritence
                            mDerivedOrientation = mOrientation;
                        }

                        
            // Update scale
                        const Vector3& parentScale = mParent->_getDerivedScale();
                        
            if (mInheritScale)
                        {
                            
            // Scale own position by parent scale, NB just combine
                            
            // as equivalent axes, no shearing
                            mDerivedScale = parentScale * mScale;
                        }
                        
            else
                        {
                            
            // No inheritence
                            mDerivedScale = mScale;
                        }

                        
            // Change position vector based on parent's orientation & scale
                        mDerivedPosition = parentOrientation * (parentScale * mPosition);

                        
            // Add altered position vector to parents
                        mDerivedPosition += mParent->_getDerivedPosition();
                    }
                    
            else
                    {
                        
            // Root node, no parent
                        mDerivedOrientation = mOrientation;
                        mDerivedPosition 
            = mPosition;
                        mDerivedScale 
            = mScale;
                    }

                    mCachedTransformOutOfDate 
            = true;
                    mNeedParentUpdate 
            = false;

                }
            //
            久久棈精品久久久久久噜噜| 99热热久久这里只有精品68| 精品国产日韩久久亚洲| 亚洲国产精品一区二区三区久久| 中文精品99久久国产| 久久精品99久久香蕉国产色戒| 久久婷婷久久一区二区三区| 理论片午午伦夜理片久久 | 久久久精品人妻一区二区三区四| 久久精品中文字幕无码绿巨人| 一本久久久久久久| 久久受www免费人成_看片中文| 99久久99久久| 精品综合久久久久久97| 久久天天躁狠狠躁夜夜2020| 99精品国产在热久久| 久久人人爽人人人人片av| 国产午夜电影久久| 国产麻豆精品久久一二三| 久久亚洲sm情趣捆绑调教| 国产成人精品久久亚洲高清不卡 | 99久久免费国产特黄| 亚洲性久久久影院| 久久精品国产亚洲Aⅴ香蕉| 久久久久人妻一区精品色| 精品多毛少妇人妻AV免费久久| 久久久艹| 色综合久久久久综合99| 久久久亚洲精品蜜桃臀| 精品久久久久久99人妻| 91精品久久久久久无码| 亚洲一区二区三区日本久久九| 久久99国内精品自在现线| 久久九九精品99国产精品| 国产亚洲精品美女久久久| 久久综合亚洲色HEZYO社区| 人妻丰满?V无码久久不卡| 青草久久久国产线免观| 久久久久久久久久久| av色综合久久天堂av色综合在| 国产成人无码精品久久久性色|