Graphics Reference
In-Depth Information
class
UWBD3D
_
TextureResource :
public
UWBD3D
_
Resource {
.
Source file.
uwbgl
_
D3D
TextureResource1.h
file in the
D3D Files/
D3D_Resources
// Access the D3D Texture Structure
A:
LPDIRECT3DTEXTURE9 GetD3DTexture();
protected
:
// To load image file
subfolder
UWBGL
_
D3D
_
Lib13
of
the
project.
B:
virtual bool
LoadResourceFromFile(fullPathName);
// D3D Texture structure
LPDIRECT3DTEXTURE9 m
_
pTexture;
.
C:
Listing 12.13.
Texture resource support.
tion for accessing the D3D texture structure. At label B,
LoadResourceFrom
File()
is overridden to load the specified image file into the D3D texture struc-
ture defined at label C (similar to the texture loading shown in Listing 12.10).
Texture Resource Storage and Activation
At label B of Listing 12.14, we see an array of file texture resources. The
FindTex
tureResource()
function searches the file texture resource array for a texture file
name. If the name is not found, the image file will be opened, and a new texture re-
source will be created and stored into the file texture resource table. Listing 12.15
shows the implementation of the activate/deactivate texture methods. At label A,
class
UWBD3D
_
GraphicsSystem {
.
Source file.
uwbgl
_
GraphicsSystem3.h
file in the
D3D Files/
D3D_GraphicsSystem
subfolder
A:
bool
ActivateTexture(texName ...);
// enable texture mapping
void
DeactivateTexture();
// disable texture mapping
of
the
UWBGL
_
D3D
_
Lib13
project.
.
// table (array) of file textures
UWB
_
PointerArray<UWBD3D
_
TextureResource
*
>m
_
texture
_
resources;
// find texture in table
UWBD3D
_
TextureResource
*
FindTextureResource(texture
_
name ...);
.
B:
Listing 12.14.
Array of texture resources in
UWBGL
.
Search WWH ::
Custom Search