• <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久久国产综合精品| 国产A级毛片久久久精品毛片| 久久久久成人精品无码| 国产综合久久久久| 久久午夜无码鲁丝片| 国产精品久久久久久久久| 久久se精品一区二区影院 | 国产精品VIDEOSSEX久久发布| 国产精品成人无码久久久久久| 日韩欧美亚洲综合久久影院Ds| 国产亚洲婷婷香蕉久久精品| 国产一区二区久久久| 久久99精品九九九久久婷婷| 亚洲国产精品久久电影欧美| 久久精品国产清自在天天线| 国内精品久久久久影院优| 狠狠色丁香久久婷婷综合图片| 久久天堂电影网| 久久亚洲国产成人精品性色| 久久中文精品无码中文字幕| 91超碰碰碰碰久久久久久综合| 无码国内精品久久人妻| 99精品国产免费久久久久久下载| 久久久精品免费国产四虎| 久久精品国产亚洲AV大全| 国产精品99久久久久久www| 久久久噜噜噜www成人网| 国内精品久久久久久中文字幕| 亚洲欧美日韩久久精品第一区| 久久亚洲国产成人影院| 久久精品国产72国产精福利| 久久综合九色综合精品| 2020久久精品国产免费| 久久ZYZ资源站无码中文动漫| 亚洲成色www久久网站夜月| 囯产极品美女高潮无套久久久 | 久久天天躁狠狠躁夜夜不卡| 日韩电影久久久被窝网| 一本色综合久久|