
本站地址:http://www.bajiao123.com

托管的 Direct3D之 使用 Frame Hierarchy 创建动画(翻译)
// First, render all sibling frames at this level passing the parent´s // aggregated transformation matrix. if(frame.FrameSibling != null) { this.RenderFrame(frame.FrameSibling, parentTransformationMatrix); } // Aggregate the transformation matrix to be used for this frame. // 1. Apply the frames transformation as specified in the x-file. // 2. Apply the custom transformation for this individual frame. // 3. Apply the parent´s aggregated transformation matrix. Matrix tm = frame.TransformationMatrix * ((CustomFrame)frame).CustomTransform * parentTransformationMatrix; // Go on and render the children of this frame, passing the transformation // we just aggregated. if(frame.FrameFirstChild != null) { this.RenderFrame(frame.FrameFirstChild, tm); } // TODO: Adjust for the possibility of a mesh container hierarchy. // Perform the actual rendering for this frame. if(frame.MeshContainer != null) this.DoRender(frame, tm);}
对于层次中的每一帧,RenderFrame 方法先传递它的父帧的变换矩阵递归调用它的同层的其它帧。然后再计算它的父帖和自己的变换矩阵来递归调用它的子帧(children)。最后调用DoRender来实现渲染当前场景。
<< 上一页 [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] ... 下一页 >>
本站地址:http://www.bajiao123.com

