Game Development Reference
In-Depth Information
// Load the cube texture.
m_CubeTexture =
ShaderResourceView.FromFile(m_Device,Application.StartupPath
+ "\\Brick.png");
// Create a SamplerDescription
SamplerDescription sd = new
SamplerDescription();
sd.Filter = Filter.MinMagMipLinear;
sd.AddressU = TextureAddressMode.Wrap;
sd.AddressV = TextureAddressMode.Wrap;
sd.AddressW = TextureAddressMode.Wrap;
sd.ComparisonFunction = Comparison.Never;
sd.MinimumLod = 0;
sd.MaximumLod = float.MaxValue;
// Create our SamplerState
m_CubeTexSamplerState =
SamplerState.FromDescription(m_Device,sd);
As you can see, the first line loads our cube texture. As mentioned before, this is
. Next, we create a sampler description, which we will use to create a sampler state
to use with our cube texture. Most of the properties of the
SamplerDescription
are beyond the scope of this text. And finally, the last line creates a
SamplerState
for our cube texture. Now that our cube texture is set up, we are ready to update the
scene in our
UpdateScene()
method.
Updating the scene
Next, we need to modify our
UpdateScene()
method. First, we need to add the fol-
lowing code after the
if
statement at the top of this method:
// Keep the cube rotating by increasing its
rotation amount
m_CubeRotation += 0.00025f;