• <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 點點滴滴 閱讀(534) 評論(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;

                }
            //
            久久久青草青青国产亚洲免观| 亚洲精品白浆高清久久久久久| 亚洲av日韩精品久久久久久a | 久久影院午夜理论片无码| 国产亚洲精午夜久久久久久| 久久综合亚洲鲁鲁五月天| 97久久香蕉国产线看观看| 亚洲国产日韩欧美综合久久| 夜夜亚洲天天久久| 久久精品国产99久久无毒不卡| 女人高潮久久久叫人喷水| 伊人色综合久久天天人守人婷| 久久综合综合久久综合| 久久久久久毛片免费播放| 久久无码精品一区二区三区| 2021精品国产综合久久| 午夜肉伦伦影院久久精品免费看国产一区二区三区 | 尹人香蕉久久99天天拍| 久久精品www| 丁香五月综合久久激情| 伊人色综合久久天天| 天堂久久天堂AV色综合 | 日韩精品久久无码人妻中文字幕| 四虎国产永久免费久久| 久久综合九色综合97_久久久| 久久伊人五月丁香狠狠色| 久久久久人妻精品一区三寸蜜桃| 久久综合久久综合九色| 久久精品中文无码资源站| 国产成人精品三上悠亚久久| 久久精品国产亚洲AV忘忧草18| 久久久国产打桩机| 模特私拍国产精品久久| 色综合合久久天天给综看| 狠狠色综合网站久久久久久久| 亚洲国产天堂久久综合网站| 精品久久久久中文字幕日本| 国产女人aaa级久久久级| 久久本道久久综合伊人| 久久av高潮av无码av喷吹| 国产女人aaa级久久久级|