float ScaleMatrix [4][4] = {
scaleX, 0.0f, 0.0f, 0.0f,
0.0f, scaleY, 0.0f, 0.0f,
0.0f, 0.0f, scaleZ, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f
};
D3DXMATRIX * D3DXMatrixScaling (
D3DXMATRIX * pOut,
FLOAT sx,
FLOAT sy,
FLOAT sz
);
Matrix Translation
The
act of moving an object is called translation. Translation allows for
an object to be moved along any of the three axes by specifying the
amount of movement needed. For example, if you want to move an object
right along the X axis, you would need to translate that object an
appropriate number of units in the positive X direction. To do so, you
would need to create a translation matrix. This matrix will then cause
any objects it affects to be moved to the right. Figure 2 shows an example of a square being translated.

Again,
I’ll start with the identity matrix and change it to add in the
variables that affect translation. Take a look at the following
translation matrix; the variables moveX, moveY, and moveZ show you where the translation values would go. If you wanted to translate an object 4 units to the right, you would replace moveX with the value 4.
float TranslationMatrix [4][4] = {
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
moveX, moveY, moveZ, 1.0f
};
The Direct3D function D3DXMatrixTranslation is used to easily create a translation matrix with any values you specify.
D3DXMATRIX* D3DXMatrixTranslation(
D3DXMATRIX *pOut,
FLOAT x,
FLOAT y,
FLOAT z
);