1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"[]>
2<html xml:lang="en-US" lang="en-US">
3  <head>
4    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5    <meta http-equiv="Content-Style-Type" content="text/css" />
6    <link rel="stylesheet" href="../../../css/document.css" type="text/css" />
7    <title>Graphix Library (gfx) Sample Demos</title>
8  </head>
9  <body>
10    <h1>DynamicMaterialDemo</h1>
11
12      <div class="section"><img src="images/DynamicMaterialDemo1.png" border="0" width="400" height="240" /> <img src="images/DynamicMaterialDemo2.png" border="0" width="400" height="240" /></div>
13
14      <h2>Overview</h2>
15      <p>
16        This demo dynamically changes material settings.<BR> This demo can change four types of material settings.<BR> In order from top down, it can perform material change, change by buffer, texture change, and lookup table change.
17      </p>
18
19      <h2>How to Use</h2>
20      <p>
21        <ul>
22          <li>Demo-specific operations</li>
23          <ul>
24            <li>None.</li>
25          </ul>
26          <li>Common Operations</li>
27          <ul>
28            <li>Slide pad: Rotate the camera</li>
29            <li>Slide pad + A Button: Move the camera back and forth</li>
30            <li>Slide pad + B Button: Move the camera in parallel</li>
31            <li>Slide pad + Y Button: Move the camera up and down</li>
32            <li>X Button: Reset the camera position</li>
33            <li>START Button: Restart the demo.</li>
34          </ul>
35        </ul>
36      </p>
37
38      <h2>Description</h2>
39      <p>
40      	This demo can change material settings.<BR> Each of the four methods of making changes will be described separately.
41      </p>
42      <h3>Changing Materials</h3>
43      <p>
44      	In the past, separate material settings were applied without setting the material configured for the model.<BR> Execute StartMaterialChangeRenderCommand before drawing a model whose material is to be changed. After rendering execute EndMaterialChangeRenderCommand.
45      </p>
46      <h3>StartMaterialChangeRenderCommand</h3>
47      <p>
48      	Set the material to be swapped using <a href="../../../nw/gfx/RenderContext/SetMaterial.html">SetMaterial</a>. Set <a href="../../../nw/gfx/RenderContext/SetRenderMode.html">SetRenderMode</a> to RENDERMODE_IGNORE_MATERIAL so that the material of the model to be drawn is not set and material settings are ignored.
49      </p>
50      <h3>EndMaterialChangeRenderCommand</h3>
51      <p>
52      	This command restores the RenderMode changed by the StartMaterialChangeRenderCommand to its original state. Set RENDERMODE_DEFAULT to restore original status.
53      </p>
54      <h3>Change by Buffer</h3>
55      <p>
56      	You can change the material settings for each model instance by using the material buffer when changing material settings.<BR> In the demo, the diffuse color of the material is changed.<BR> To use the material buffer, specify the option you want to use with <a href="../../../nw/gfx/SceneBuilder/BufferOption.html">BufferOption</a> from <a href="../../../nw/gfx/Model/BufferOption.html">BufferOption</a>.
57      </p>
58      <h3>Texture Change</h3>
59	  <p>
60      	To dynamically set textures, set <a href="../../../nw/gfx/res/ResTextureMapper/SetTexture.html">SetTexture</a> to <a href="../../../nw/gfx/res/ResTexture/Overview.html">ResTexture</a>. Ownership does not change even if SetTexture is set.<BR> If a texture change has been made, invalidate the hash by setting <span>nw::gfx::res::ResMaterial::SetTextureMappersHash</span> to 0.
61      </p>
62      <h3>Lookup Table Change</h3>
63      <p>
64      	To dynamically change lookup tables, set <a href="../../../nw/gfx/res/ResLightingLookupTable/SetSampler.html">SetSampler</a> to <a href="../../../nw/gfx/res/ResLookupTable/Overview.html">ResLookupTable</a>. Ownership does not change even if SetSampler is set.<BR> If a lookup table change has been made, invalidate the hash by setting <span>nw::gfx::res::ResMaterial::SetFragmentLightingTableHash</span> to 0.
65      </p>
66  <hr><p>CONFIDENTIAL</p></body>
67</html>
68
69