⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 skinningsample.htm

📁 c# XNA walking animation
💻 HTM
📖 第 1 页 / 共 2 页
字号:
	}
	
.label
	{
	font-weight: bold; 
	margin-top: 1em;
	margin-left: -26px;
	}
	
.tl
	{
	margin-bottom: .75em; 
	}
	
.atl
	{
	padding-left: 1.5em;
	padding-bottom: .75em; 
	}
	
.cfe
	{
	font-weight: bold; 
	}
	
.mini
	{
	font-size: smaller;
	}
	
.dt
	{
	margin-bottom: -.6em; 
	}
	
.indent
	{
	margin-left: 1.9em; 
	margin-right: 1.9em;
	}

.product
	{
	text-align: right;
	color: #333333;
	font-size: smaller;
	font-style: italic;
	}

.buttonbarshade
	{
	position: relative;
	margin: 0;
	left: 0px;
	top: 2;
	width: 50%;
	height: 40px;
	}

.buttonbartable
	{
	position: absolute;
	margin: 0;
	padding:0;
	border:0;
	left:0px;
	top: 2;
	width: 100%;
	height: 40px;
	}

/* background color, font for header */ 
table.buttonbartable td, table.buttonbarshade td
	{
	background: #ffffff; /*#5177B8; #80C615;*/
	border-left: 0px solid #80C615;
	margin: 0;
	padding: 0px 0px 0px 0px;
	font-family: Impact, sans-serif;
	font-size: 14pt;
	}

table.buttonbartable td.button1
	{
	background: #5177B8; /*#80C615;*/;
	padding: 0;
	font-weight: bold;
	text-align: center;
	cursor: hand;
	}

table.buttonbartable td.button2
	{
	background: #5177B8; /*#80C615;*/;
	font-weight: bold;
	text-align: center;
	}

table.buttonbartable td.button3
	{
	background: #5177B8; /*#80C615;*/;
	font-weight: bold;
	text-align: center;
	}

table.buttonbartable td.runninghead
	{
	padding-left: 0px;
	font-style: italic;
	text-align: left;
	}

.version
	{
	text-align: left;
	color: #000000;
	margin-top: 3em;
	margin-left: -26px;
	font-size: smaller;
	font-style: italic;
	}

.lang, .ilang
	{
	color: #0000ff;
	font: normal 7pt Arial, Helvetica, sans-serif;
	}

div.langMenu
	{
	position: absolute;
	z-index: 1;
	width: 96pt;
	padding: 8pt;
	visibility: hidden;
	border: 1px solid #000000;
	background: #ffffd0;
	}

div.langMenu ul
	{
	padding-left: 2em;
	margin-left: 0;
	}

div.filtered
	{
	margin: 4pt 0 8pt -26px;
	padding: 4px 4px 8px 26px;
	width: 100%;
	border: 2px solid #aaaacc;
	background: #ffffff;
	}

div.filtered2
	{
	margin: 4pt 0 8pt -26px;
	padding: 4px 4px 8px 26px;
	width: 100%;
	border: none;
	background: #ffffff;
	}

div.filtered h1, div.filtered h2, div.filtered h3, div.filtered h4
	{
	margin-left: -22px;
	}

div.filtered span.lang
	{
	position: relative;
	left: -22px;
	}

div.reftip
	{
	position: absolute;
	z-index: 1;
	padding: 8pt;
	visibility: hidden;
	border: 1px solid #000000;
	background: #ffffd0;
	}

a.synParam
	{
	color: #0000FF;
	/*color: #3F7800;*/ 	
	/*color: #8DC54F;*/
	text-decoration: none;
    font-weight: normal;
	}

a.synParam:hover
	{
	text-decoration: underline;
    font-weight: normal;
	}

div.sapop
	{
	position: absolute;
	z-index: 1;
	left: 26px;
	width: 100%;
	padding: 10px 10px 10px 36px;
	visibility: hidden;
	border: 1px solid #000000;
	background: #ffffd0;
	}

div.footer
	{
	width: 100%;
	border: none;
	background: #ffffff;
	margin-top: 18pt;
	padding-bottom: 12pt;
	color: #0000FF;
	/*color: #228B22; */
	text-align: center;
	font-size: 76%;
	}

div.preliminary
	{
	margin-top: 8pt;
	padding-bottom: 12pt;
	color: #A0A0A0;
	}

/* A procedure section. eg. 'To create a file', 'To add a value' */
div.proc
    {
	margin-left: 0.5em; 
    }
     
/* The title of a 'procedure' section. */
div.proc h3
    {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-weight: bold;
	font-size: 115%;
	margin-top: 1em;
	margin-bottom: 0.4em;
	margin-left: -0.5em; 
	color: #003399;
    }

div.proc ul
    {
    margin-left: 1.5em;
    }

div.proc ol
    {
    margin-left: 2.0em;
    }
      
.note
	{
	margin-left: 14pt;
	margin-right: 12pt;
	}

.indent1
	{
	margin-left: 12pt;
	}

.indent2
	{
	margin-left: 24pt;
	}

.indent3
	{
	margin-left: 36pt;
	}

p.proch
	{
	padding-left: 16px;
	}

p.proch img
	{
	position: relative; 
	vertical-align: top;
	left: -18px; 
	margin-right: -14px; 
	margin-bottom: -18px;
	}
	
div.clsPlatSpec
{
	background-color:#FFF8DC;
	border-style:solid;
	border-width:1pt 0pt 0pt 1pt;
	border-color:#ffE4C4;
	margin-top:0.6em;
	width:100%;
}


/* Applies to the language labels in the Language Filter drop-down list. */
.languageFilter
{
	color:	#0000FF;
	cursor:hand;
	text-decoration:underline;
	padding-bottom:4;
}

/* Dropdown areas */

#languageSpan {
	position: absolute;
	visibility: hidden;
	border-style: solid;
	border-width: 1px;
	border-color: #C8CDDE;
	background: #d4dfff;
	padding: 4px;
	font-size: 70%;
}

#membersOptionsSpan {
	position: absolute;
	visibility: hidden;
	border-style: solid;
	border-width: 1px;
	border-color: #C8CDDE;
	background: #d4dfff;
	padding: 4px;
	font-size: 70%;
}
--></style>

<xml>
<MSHelp:TOCTitle Title="Skinned Model Sample" />
<MSHelp:RLTitle Title="Skinned Model Sample" />
<MSHelp:Keyword Index="A" Term="O:Microsoft.Xna.Skinning" />
<MSHelp:Keyword Index="A" Term="da2e2b3d-2bba-d6f2-59ab-ad18962e3ea4" />
<MSHelp:Keyword Index="K" Term="Skinned Model Sample" />
<MSHelp:Attr Name="ProjType" Value="LocalProj" />
<MSHelp:Attr Name="ProjType" Value="XNA_20" />
<MSHelp:Attr Name="DocSet" Value="XNA" />
<MSHelp:Attr Name="DocSet" Value="ExpressLibVS" />
<MSHelp:Attr Name="DocSet" Value="C#" />
<MSHelp:Attr Name="Locale" Value="en-us" />
<MSHelp:Attr Name="AssetID" Value="da2e2b3d-2bba-d6f2-59ab-ad18962e3ea4" />
<MSHelp:Attr Name="TopicType" Value="kbOrient" />
</xml>
</head><body><div id="mainSection"><div id="mainBody">
  <h1>Skinned Model Sample</h1>

  This sample shows how to process and render a skinned character model using the XNA Framework Content Pipeline.

  <a name="ID2EK"></a><h1 class="heading">Sample Overview</h1><div id="ID2EK" class="hxnx1">
    

    <p>Out of the box, the XNA Framework provides only partial support for animation. It defines an intermediate object model for storing animation data inside the Content Pipeline, and can import data into this object model from FBX and X formats. The built-in <a href="http://msdn2.microsoft.com/en-us/library/microsoft.xna.framework.content.pipeline.processors.modelprocessor.aspx">ModelProcessor</a> also converts vertex channels of BoneWeightCollection data into pairs of channels with VertexElementUsage BlendIndices and BlendWeight, suitable for skinned rendering on the GPU. The framework does not include any run-time animation classes, however. That functionality is implemented by this sample.</p>

    <a name="ID2EV"></a><h2 class="subHeading">Minimum Shader Profile</h2><div id="ID2EV" class="hxnx2">
      
      <dl class="glossary">
        <dt>Vertex Shader Model 2.0</dt>
        <dt>Pixel Shader Model 2.0</dt>
      </dl>
    </div>

    <a name="ID2EBB"></a><h2 class="subHeading">Sample Controls</h2><div id="ID2EBB" class="hxnx2">
      
      <p>This sample uses the following keyboard and gamepad controls.</p>
      <table>
        <tr>
          <th>Action</th>
          <th>Keyboard Control</th>
          <th>Gamepad Control</th>
        </tr>
        <tr>
          <td>Rotate the model.</td>
          <td>
            <p>UP ARROW, DOWN ARROW, LEFT ARROW, and RIGHT ARROW</p>
            <p>or <b>W</b>, <b>S</b>, <b>A</b>, and <b>D</b>
            </p>
          </td>
          <td>Right thumb stick</td>
        </tr>
        <tr>
          <td>Zoom.</td>
          <td><b>Z</b> and <b>X</b>
          </td>
          <td>Triggers</td>
        </tr>
        <tr>
          <td>Pause or resume light animation.</td>
          <td>SPACEBAR</td>
          <td>
            <b>A</b>
          </td>
        </tr>
        <tr>
          <td>Reset.</td>
          <td>
            <b>R</b>
          </td>
          <td>Right thumb stick press</td>
        </tr>
        <tr>
          <td>Exit.</td>
          <td>ESC or ALT+F4</td>
          <td>
            <b>BACK</b>
          </td>
        </tr>
      </table>
  </div>
    </div>

  <a name="ID2E4D"></a><h1 class="heading">How the Sample Works</h1><div id="ID2E4D" class="hxnx1">
    

    <p>There are three projects in the sample.</p>
    <ul>
      <li><b>SkinnedModel</b> contains the classes used to store and play back animation data. These types are used both during the Content Pipeline build process and at run time by the game.</li>
      <li><b>SkinnedModelPipeline</b> is a Content Pipeline assembly. It implements a new content processor for building skinned models.
  </li>
      <li><b>SkinningSample</b> is a sample game showing how to animate and render a skinned model.</li>
    </ul>
    <p>The sample contains separate projects for <b>SkinnedModel</b> and <b>SkinningSample</b>, used when developing for Windows or Xbox 360. Only a single project is required for <b>SkinnedModelPipeline</b>, as this runs only on Windows as part of the Content Pipeline build process.</p>

    <p>The Xbox 360 solution file includes both Xbox 360 and Windows versions of the <b>SkinnedModel</b> project. This assembly is used both during the content build process (on Windows) and at run time (on Xbox 360), so it must be built for both platforms.</p>

    <p>To render a skinned model, we need two things:</p>
    <ol>
      <li>An effect that will implement the mesh deformation.</li>
      <li>Some animation data describing how the mesh should be deformed.</li>
    </ol>
    <p>The <b>SkinnedModelProcessor</b> attaches all this information to the existing <a href="http://msdn2.microsoft.com/en-us/library/microsoft.xna.framework.graphics.model.aspx">Model</a> type provided by the XNA Framework.</p>

    <p>The <b>SkinnedModelProcessor.ConvertMaterial</b> method attaches new effects to the model by creating new instances of the <a href="http://msdn2.microsoft.com/en-us/library/microsoft.xna.framework.content.pipeline.graphics.effectmaterialcontent.aspx">EffectMaterialContent</a> class. It copies texture information across from the input material, but always sets the <b>Effect</b> property to reference our custom SkinnedModel.fx file.</p>

    <p>Note that although the skinned model effect is included as part of the Game Studio project file, it is not part of the content project. This effect will be built automatically because it is referenced by the <b>SkinnedModelProcessor</b>, so there is no need for it to be duplicated in the content project. It was only included here so you can easily locate the file for viewing or editing the effect code.</p>

    <p>Animation data is converted into a suitable run-time format by the <b>SkinnedModelProcessor</b>.<b>ProcessAnimations</b> method, which stores a custom <b>SkinningData</b> object in the <a href="http://msdn2.microsoft.com/en-us/library/microsoft.xna.framework.graphics.model.tag.aspx">Tag</a> property of the framework <a href="http://msdn2.microsoft.com/en-us/library/microsoft.xna.framework.graphics.model.aspx">Model</a> instance.</p>
  </div>
  <a name="ID2EUG"></a><h1 class="heading">Extending the Sample</h1><div id="ID2EUG" class="hxnx1">
    

    <p>The <b>AnimationPlayer</b> class that the sample implements can play back only a single animation at a time. You could implement blending between multiple animations, or play back different animations on different parts of the character, by calling <b>UpdateBoneTransforms</b> on several <b>AnimationPlayer</b> instances. You'd then blend the resulting matrices into the <b>BoneTransforms</b> array of a single output player before calling <b>UpdateWorldTransforms</b> and <b>UpdateSkinTransforms</b>.</p>
  </div>

</div><div class="footer" id="footer"><p>© 2007 Microsoft Corporation. All rights reserved.<br>Send feedback to <a href="mailto:xnags@microsoft.com?subject=Documentation Feedback: Skinned Model Sample">xnags@microsoft.com</a>.</p></div></div></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -