using mouse to scale an object, in directx
<p>I am having trouble scaling a few different 3d objects with the mouse.  It looks to me like I have all the code that is necessary to scale the objects with the mouse.  Here is the code that I have for the project that I am working on.
The code where I scale the objects and position them is at the bottom of the init function, or where it says object positions. In the middle of the update function I have the code to use the mouse to scale them, which looks to me like that should be all I need.  The variable planetscaling I actually created in another class as a float, and just inheriting it from that class
Any bit of help will be greatly appreciated.
Thanks</p>

<pre><code>    D3DXCreateTextureFromFile(m_pD3DDevice, L"1.bmp", &amp;mTex0);
    D3DXCreateTextureFromFile(m_pD3DDevice, L"Textures//Sun.jpg", &amp;m_pTexture[0]);
    D3DXCreateTextureFromFile(m_pD3DDevice, L"1.bmp", &amp;mTex0);
    D3DXCreateTextureFromFile(m_pD3DDevice, L"Textures//earth.jpg", &amp;m_pTexture[1]);
    D3DXCreateTextureFromFile(m_pD3DDevice, L"1.bmp", &amp;mTex0);
    D3DXCreateTextureFromFile(m_pD3DDevice, L"Textures//mercury.jpg", &amp;m_pTexture[2]);
    D3DXCreateTextureFromFile(m_pD3DDevice, L"1.bmp", &amp;mTex0);
    D3DXCreateTextureFromFile(m_pD3DDevice, L"Textures//venus.jpg", &amp;m_pTexture[3]);
    D3DXCreateTextureFromFile(m_pD3DDevice, L"1.bmp", &amp;mTex0);
    D3DXCreateTextureFromFile(m_pD3DDevice, L"Textures//mars.jpg", &amp;m_pTexture[4]);
    D3DXCreateTextureFromFile(m_pD3DDevice, L"1.bmp", &amp;mTex0);
    D3DXCreateTextureFromFile(m_pD3DDevice, L"Textures//jupiter.jpg", &amp;m_pTexture[5]);
    D3DXCreateTextureFromFile(m_pD3DDevice, L"1.bmp", &amp;mTex0);
    D3DXCreateTextureFromFile(m_pD3DDevice, L"Textures//saturn.jpg", &amp;m_pTexture[6]);
    D3DXCreateTextureFromFile(m_pD3DDevice, L"1.bmp", &amp;mTex0);
    D3DXCreateTextureFromFile(m_pD3DDevice, L"Textures//uranus.jpg", &amp;m_pTexture[7]);
    D3DXCreateTextureFromFile(m_pD3DDevice, L"1.bmp", &amp;mTex0);
    D3DXCreateTextureFromFile(m_pD3DDevice, L"Textures//neptune.jpg", &amp;m_pTexture[8]);
    D3DXCreateTextureFromFile(m_pD3DDevice, L"1.bmp", &amp;mTex0);
    D3DXCreateTextureFromFile(m_pD3DDevice, L"Textures//moon.jpg", &amp;m_pTexture[9]);

    m_pEffect-&gt;SetTexture("Texture", mTex0);
    m_pEffect-&gt;SetFloat("DiffuseIntensity", 1.5f );
    m_pEffect-&gt;SetFloat("LineThickness", 0.15f );

#pragma endregion Effects

#pragma region Object Positions
    //positions

    DirectInput8Create(hInst, DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&amp;input, NULL);

    // Initialize Keyboard
    input-&gt;CreateDevice(GUID_SysKeyboard, &amp;m_pDIKeyboard, NULL);

    // Initialize Mouse
    input-&gt;CreateDevice(GUID_SysMouse, &amp;m_pDIMouse, NULL);

    // Set up Keyboard
    m_pDIKeyboard-&gt;SetCooperativeLevel(hWnd, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);
    m_pDIKeyboard-&gt;SetDataFormat(&amp;c_dfDIKeyboard);

    // Set up Mouse (c_dfDIMouse2 = 8 button mouse)
    m_pDIMouse-&gt;SetCooperativeLevel(hWnd, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);
    m_pDIMouse-&gt;SetDataFormat(&amp;c_dfDIMouse2);

    D3DXVECTOR3 pos[12];

    planetscaling[0] = 95.0f;
    planetscaling[1] = 900.0f;
    planetscaling[2] = 900.0f;
    planetscaling[3] = 900.0f;
    planetscaling[4] = 1000.0f;
    planetscaling[5] = 600.0f;
    planetscaling[6] = 650.0f;
    planetscaling[7] = 665.0f;
    planetscaling[8] = 660.0f;
    planetscaling[9] = 1350.0f;

    pos[0] = D3DXVECTOR3(0.0f, 0.0f, planetscaling[0]);         // Sun
    pos[1] = D3DXVECTOR3(150.0f, 20.0f, planetscaling[1]);      // Earth
    pos[2] = D3DXVECTOR3(50.0f, 50.0f, planetscaling[2]);       // Mercury
    pos[3] = D3DXVECTOR3(100.0f, 0.0f, planetscaling[3]);       // Venus
    pos[4] = D3DXVECTOR3(0.0f, -200.0f, planetscaling[4]);      // Mars
    pos[5] = D3DXVECTOR3(-40.0f, 0.0f, planetscaling[5]);       // Jupiter
    pos[6] = D3DXVECTOR3(-50.0f, -100.0f, planetscaling[6]);    // Saturn
    pos[7] = D3DXVECTOR3(20.0f, -100.0f, planetscaling[7]);     // Uranus
    pos[8] = D3DXVECTOR3(0.0f, -70.0f, planetscaling[8]);       // Neptune
    pos[9] = D3DXVECTOR3(150.0f, 20.0f, planetscaling[9]);  

    Object[0].set(Sun,    pos[0], 4.8f, -1, mTex0); // Sun
    Object[1].set(PLANET, pos[1], 4.8f, -1, mTex0); // Earth
    Object[2].set(PLANET, pos[2], 4.8f, -1, mTex0); // Mercury
    Object[3].set(PLANET, pos[3], 4.8f, -1, mTex0); // Venus
    Object[4].set(PLANET, pos[4], 4.8f, -1, mTex0); // Mars
    Object[5].set(PLANET, pos[5], 4.8f, -1, mTex0); // Jupiter
    Object[6].set(PLANET, pos[6], 4.8f, -1, mTex0); // Saturn
    Object[7].set(PLANET, pos[7], 4.8f, -1, mTex0); // Uranus
    Object[8].set(PLANET, pos[8], 4.8f, -1, mTex0); // Neptune
    Object[9].set(MOON,   pos[9], 4.8f, -1, mTex0); // moon

#pragma endregion Object Positions

}
float PlanetClass::Update(double dt, IDirect3DDevice9*  m_pD3DDevice)
{

    for(int i = 0; i &lt; 12; i++)
    {
        if(i == 0)
            continue;
        D3DXMatrixRotationY(&amp;rotMat, (float)timeGetTime() * 0.009f);
        D3DXMatrixTranslation(&amp;transMat, Object[i].position.x, Object[i].position.y, Object[i].position.z);
        D3DXMatrixScaling(&amp;ScaleMat, planetscaling[i], planetscaling[i], planetscaling[i]);
        Object[i].toParentXForm = rotMat * transMat;
    }

        D3DXMatrixRotationY(&amp;rotMat, Object[0].yAngle);
        D3DXMatrixTranslation(&amp;transMat, Object[0].position.x, Object[0].position.y, Object[0].position.z);
        D3DXMatrixScaling(&amp;ScaleMat, planetscaling[0], planetscaling[0], planetscaling[0]);
        Object[0].toParentXForm = rotMat * transMat;

    DIMOUSESTATE2 mouseState;
    ZeroMemory(&amp;mouseState, sizeof(mouseState));

    // Get the input device state
    hr = m_pDIMouse-&gt;GetDeviceState( sizeof(DIMOUSESTATE2), &amp;mouseState );
    if(FAILED(hr))
    {
        hr = m_pDIMouse-&gt;Acquire();

        // Device has probably been lost if failed, if so keep trying to get it until it’s found.
        while( hr == DIERR_INPUTLOST)
        {
            hr = m_pDIMouse-&gt;Acquire();
        }

        // If we failed for some other reason
        for(int i = 0; i &lt; 12; i++)
        {
            if(FAILED(hr))
            return planetscaling[i];
            // Read the device state again
            m_pDIMouse-&gt;GetDeviceState(sizeof(DIMOUSESTATE2), &amp;mouseState);
        }

    }

    for(int i = 0; i &lt; 12; i++)
    {
        if(mouseState.rgbButtons[1] &amp; 0x80)
        {
            planetscaling[i] += mouseState.lX * 0.01f; // X Axis
            planetscaling[i] += mouseState.lY * 0.01f; // Y Axis
            m_pD3DDevice-&gt;SetRenderState(D3DRS_NORMALIZENORMALS, true);
        }
    }

            rad = 270.0f;
            radM = 150.0f;
            radV = 215.0f;
            radMA = 360.0f;
            radJ = 260.0f;
            radS = 330.0f;
            radU = 390.0f;
            radN = 450.0f;
            radMO = 370.0f;

            double time = timeGetTime() * 0.00009;
            double timeM = timeGetTime() * 0.0002;
            double timeV = timeGetTime() * 0.0001;
            double timeMA = timeGetTime() * 0.00008;
            double timeJ =  timeGetTime() * 0.000009;
            double timeS = timeGetTime() * 0.000008;
            double timeU = timeGetTime() * 0.000007;
            double timeN = timeGetTime() * 0.000006;
            double timeMO = timeGetTime() * 0.00009;

            Object[1].size = 2.0f;

            Object[2].position.x = sin(timeM)*radM;
            Object[2].position.y = cos(timeM)*radM;

            Object[3].position.x = sin(timeV)*radV;
            Object[3].position.y = cos(timeV)*radV;

            Object[1].position.x = sin(time)*rad;
            Object[1].position.y = cos(time)*rad;

            Object[4].position.x = sin(timeMA)*radMA;
            Object[4].position.y = cos(timeMA)*radMA;

            Object[5].position.x = sin(timeJ)*radJ;
            Object[5].position.y = cos(timeJ)*radJ;

            Object[6].position.x = sin(timeS)*radS;
            Object[6].position.y = cos(timeS)*radS;

            Object[7].position.x = sin(timeU)*radU;
            Object[7].position.y = cos(timeU)*radU;

            Object[8].position.x = sin(timeN)*radN;
            Object[8].position.y = cos(timeN)*radN;

            Object[9].position.x = sin(timeMO)*radMO;
            Object[9].position.y = cos(timeMO)*radMO;




    // For each object...
    for(int i = 0; i &lt; 12; ++i)
    {
        // Initialize to identity matrix.
        D3DXMatrixIdentity(&amp;Object[i].toWorldXForm);

        // The ith object's world transform is given by its
        // to-parent transform, followed by its parent's
        // to-parent transform, followed by its grandparent's
        // to-parent transform, and so on, up to the root's
        // to-parent transform.
        int k = i;
        while( k != -1 ) // While there exists an ancestor.
        {
            Object[i].toWorldXForm *= Object[k].toParentXForm;
            k = Object[k].parent; // Move up the ancestry chain.
        }
    }

    return (float)Object[0].yAngle;
}



void PlanetClass::Render(IDirect3DDevice9*  m_pD3DDevice, double dt, int select)
{
    //////////////////////////////////////////////////////////////////////////
    // Draw 3D Objects
    //////////////////////////////////////////////////////////////////////////

    //m_pD3DDevice-&gt;Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL, 0xffeeeeee, 1.0f, 0);

    //////////////////////////////////////////////////////////////////////////
    // Matrix Transformations to control each objects position, scale, and 
    // rotation.  Set these matrices for each object you want to render.
    //////////////////////////////////////////////////////////////////////////
    D3DXMatrixIdentity(&amp;transMat);
    D3DXMatrixIdentity(&amp;scaleMat);
    D3DXMatrixIdentity(&amp;rotMat);
    D3DXMatrixIdentity(&amp;worldMat);
    D3DXMatrixIdentity(&amp;world);

    m_pD3DDevice-&gt;SetStreamSource(0,(IDirect3DVertexBuffer9*)m_pAdjBuffer, 0, m_pAdjBuffer-&gt;GetBufferSize());

    //m_pD3DDevice-&gt;SetIndices(NULL);

    m_pD3DDevice-&gt;SetVertexDeclaration((IDirect3DVertexDeclaration9*)m_pAdjBuffer);

    m_pD3DDevice-&gt;SetRenderState(D3DRS_ZWRITEENABLE, true);

    #pragma region draw world
    //////////////////////////////////////////////////////////////////////////
    // Ball
    //////////////////////////////////////////////////////////////////////////

    // Calculate Matrix Transform

    //Update(dt);
    m_pEffect-&gt;Begin(&amp;pass, 0);
    //D3DXMATRIX S;
    //D3DXMatrixScaling(&amp;scaleMat, 1.0f, 1.0f, 1.0f);           // Scaling
    //for(int i = 0; i &lt; 3; ++i)
    //{
        worldMat = Object[0].toWorldXForm;
        D3DXMatrixInverse(&amp;WITMat, 0, &amp;worldMat);
        D3DXMatrixTranspose(&amp;WITMat, &amp;WITMat);
        //m_pEffect-&gt;SetMatrix("worldViewProjMat", &amp;(worldMat * m_viewMat * m_projMat));
        //m_pEffect-&gt;SetMatrix("worldInverseTransposeMat", &amp;WITMat);
        //m_pEffect-&gt;SetMatrix("worldMat", &amp;worldMat);

            m_pEffect-&gt;SetMatrix("Projection", &amp;m_projMat);
            m_pEffect-&gt;SetMatrix("World", &amp;worldMat);
            m_pEffect-&gt;SetMatrix("View", &amp;m_viewMat);
            m_pEffect-&gt;SetFloatArray("DiffuseLightDirection",(float*)&amp;m_Light.Position, 3);
            m_pEffect-&gt;SetFloat("LineThickness", 0.2f);
            m_pEffect-&gt;SetFloat("DiffuseIntensity", 3.0f);


        for(int i=0; i &lt; pass; i++)
        {   
            // Begin the pass
            m_pEffect-&gt;BeginPass(i);
            //
            for (DWORD i = 0; i &lt; m_numMaterials; ++i) 
            {
                m_pEffect-&gt;SetValue("DiffuseColor",
                    &amp;meshMaterials[i].Diffuse, sizeof(D3DXCOLOR));
                if( meshTextures[i] != 0)
                {
                    m_pEffect-&gt;SetTexture("Texture", meshTextures[i]);
                }
                // But if not, then set a pure white texture.  When the texture color
                // is multiplied by the color from lighting, it is like multiplying by
                // 1 and won't change the color from lighting.
                else
                {
                    m_pEffect-&gt;SetTexture("Texture", m_pTexture[0]);
                }
                // After setting object specific parameters, commit changes 
                //m_pEffectToon-&gt;SetTexture("Texture", m_pTexture[0]);
                m_pEffect-&gt;CommitChanges();
                // Draw the mesh subset
                m_pStaticBall-&gt;DrawSubset(2);
            }
            // End the pass
            m_pEffect-&gt;EndPass();
        }// Loop Ends

        worldMat = Object[1].toWorldXForm;
        D3DXMatrixInverse(&amp;WITMat, 0, &amp;worldMat);
        D3DXMatrixTranspose(&amp;WITMat, &amp;WITMat);
        //m_pEffect-&gt;SetMatrix("worldViewProjMat", &amp;(worldMat * m_viewMat * m_projMat));
        //m_pEffect-&gt;SetMatrix("worldInverseTransposeMat", &amp;WITMat);
        //m_pEffect-&gt;SetMatrix("worldMat", &amp;worldMat);

            m_pEffect-&gt;SetMatrix("Projection", &amp;m_projMat);
            m_pEffect-&gt;SetMatrix("World", &amp;worldMat);
            m_pEffect-&gt;SetMatrix("View", &amp;m_viewMat);
            m_pEffect-&gt;SetFloatArray("DiffuseLightDirection",(float*)&amp;m_Light.Position, 3);
            m_pEffect-&gt;SetFloat("LineThickness", 0.2f);
            m_pEffect-&gt;SetFloat("DiffuseIntensity", 3.0f);


        for(int i=0; i &lt; pass; i++)
        {   
            // Begin the pass
            m_pEffect-&gt;BeginPass(i);
            //
            for (DWORD i = 0; i &lt; m_numMaterials; ++i) 
            {
                m_pEffect-&gt;SetValue("DiffuseColor",
                    &amp;meshMaterials[i].Diffuse, sizeof(D3DXCOLOR));
                if( meshTextures[i] != 0)
                {
                    m_pEffect-&gt;SetTexture("Texture", meshTextures[i]);
                }
                // But if not, then set a pure white texture.  When the texture color
                // is multiplied by the color from lighting, it is like multiplying by
                // 1 and won't change the color from lighting.
                else
                {
                    m_pEffect-&gt;SetTexture("Texture", m_pTexture[1]);
                }
                // After setting object specific parameters, commit changes 
                //m_pEffectToon-&gt;SetTexture("Texture", m_pTexture[0]);
                m_pEffect-&gt;CommitChanges();
                // Draw the mesh subset
                m_pStaticBall-&gt;DrawSubset(2);
            }
            // End the pass
            m_pEffect-&gt;EndPass();
        }// Loop Ends

        worldMat = Object[2].toWorldXForm;
        D3DXMatrixInverse(&amp;WITMat, 0, &amp;worldMat);
        D3DXMatrixTranspose(&amp;WITMat, &amp;WITMat);
        //m_pEffect-&gt;SetMatrix("worldViewProjMat", &amp;(worldMat * m_viewMat * m_projMat));
        //m_pEffect-&gt;SetMatrix("worldInverseTransposeMat", &amp;WITMat);
        //m_pEffect-&gt;SetMatrix("worldMat", &amp;worldMat);

            m_pEffect-&gt;SetMatrix("Projection", &amp;m_projMat);
            m_pEffect-&gt;SetMatrix("World", &amp;worldMat);
            m_pEffect-&gt;SetMatrix("View", &amp;m_viewMat);
            m_pEffect-&gt;SetFloatArray("DiffuseLightDirection",(float*)&amp;m_Light.Position, 3);
            m_pEffect-&gt;SetFloat("LineThickness", 0.2f);
            m_pEffect-&gt;SetFloat("DiffuseIntensity", 3.0f);


        for(int i=0; i &lt; pass; i++)
        {   
            // Begin the pass
            m_pEffect-&gt;BeginPass(i);
            //
            for (DWORD i = 0; i &lt; m_numMaterials; ++i) 
            {
                m_pEffect-&gt;SetValue("DiffuseColor",
                    &amp;meshMaterials[i].Diffuse, sizeof(D3DXCOLOR));
                if( meshTextures[i] != 0)
                {
                    m_pEffect-&gt;SetTexture("Texture", meshTextures[i]);
                }
                // But if not, then set a pure white texture.  When the texture color
                // is multiplied by the color from lighting, it is like multiplying by
                // 1 and won't change the color from lighting.
                else
                {
                    m_pEffect-&gt;SetTexture("Texture", m_pTexture[2]);
                }
                // After setting object specific parameters, commit changes 
                //m_pEffectToon-&gt;SetTexture("Texture", m_pTexture[0]);
                m_pEffect-&gt;CommitChanges();
                // Draw the mesh subset
                m_pStaticBall-&gt;DrawSubset(2);
            }
            // End the pass
            m_pEffect-&gt;EndPass();
        }// Loop Ends

        worldMat = Object[3].toWorldXForm;
        D3DXMatrixInverse(&amp;WITMat, 0, &amp;worldMat);
        D3DXMatrixTranspose(&amp;WITMat, &amp;WITMat);
        //m_pEffect-&gt;SetMatrix("worldViewProjMat", &amp;(worldMat * m_viewMat * m_projMat));
        //m_pEffect-&gt;SetMatrix("worldInverseTransposeMat", &amp;WITMat);
        //m_pEffect-&gt;SetMatrix("worldMat", &amp;worldMat);

            m_pEffect-&gt;SetMatrix("Projection", &amp;m_projMat);
            m_pEffect-&gt;SetMatrix("World", &amp;worldMat);
            m_pEffect-&gt;SetMatrix("View", &amp;m_viewMat);
            m_pEffect-&gt;SetFloatArray("DiffuseLightDirection",(float*)&amp;m_Light.Position, 3);
            m_pEffect-&gt;SetFloat("LineThickness", 0.2f);
            m_pEffect-&gt;SetFloat("DiffuseIntensity", 3.0f);


        for(int i=0; i &lt; pass; i++)
        {   
            // Begin the pass
            m_pEffect-&gt;BeginPass(i);
            //
            for (DWORD i = 0; i &lt; m_numMaterials; ++i) 
            {
                m_pEffect-&gt;SetValue("DiffuseColor",
                    &amp;meshMaterials[i].Diffuse, sizeof(D3DXCOLOR));
                if( meshTextures[i] != 0)
                {
                    m_pEffect-&gt;SetTexture("Texture", meshTextures[i]);
                }
                // But if not, then set a pure white texture.  When the texture color
                // is multiplied by the color from lighting, it is like multiplying by
                // 1 and won't change the color from lighting.
                else
                {
                    m_pEffect-&gt;SetTexture("Texture", m_pTexture[3]);
                }
                // After setting object specific parameters, commit changes 
                //m_pEffectToon-&gt;SetTexture("Texture", m_pTexture[0]);
                m_pEffect-&gt;CommitChanges();
                // Draw the mesh subset
                m_pStaticBall-&gt;DrawSubset(2);
            }
            // End the pass
            m_pEffect-&gt;EndPass();
        }// Loop Ends

        worldMat = Object[4].toWorldXForm;
        D3DXMatrixInverse(&amp;WITMat, 0, &amp;worldMat);
        D3DXMatrixTranspose(&amp;WITMat, &amp;WITMat);
        //m_pEffect-&gt;SetMatrix("worldViewProjMat", &amp;(worldMat * m_viewMat * m_projMat));
        //m_pEffect-&gt;SetMatrix("worldInverseTransposeMat", &amp;WITMat);
        //m_pEffect-&gt;SetMatrix("worldMat", &amp;worldMat);

            m_pEffect-&gt;SetMatrix("Projection", &amp;m_projMat);
            m_pEffect-&gt;SetMatrix("World", &amp;worldMat);
            m_pEffect-&gt;SetMatrix("View", &amp;m_viewMat);
            m_pEffect-&gt;SetFloatArray("DiffuseLightDirection",(float*)&amp;m_Light.Position, 3);
            m_pEffect-&gt;SetFloat("LineThickness", 0.2f);
            m_pEffect-&gt;SetFloat("DiffuseIntensity", 3.0f);


        for(int i=0; i &lt; pass; i++)
        {   
            // Begin the pass
            m_pEffect-&gt;BeginPass(i);
            //
            for (DWORD i = 0; i &lt; m_numMaterials; ++i) 
            {
                m_pEffect-&gt;SetValue("DiffuseColor",
                    &amp;meshMaterials[i].Diffuse, sizeof(D3DXCOLOR));
                if( meshTextures[i] != 0)
                {
                    m_pEffect-&gt;SetTexture("Texture", meshTextures[i]);
                }
                // But if not, then set a pure white texture.  When the texture color
                // is multiplied by the color from lighting, it is like multiplying by
                // 1 and won't change the color from lighting.
                else
                {
                    m_pEffect-&gt;SetTexture("Texture", m_pTexture[4]);
                }
                // After setting object specific parameters, commit changes 
                //m_pEffectToon-&gt;SetTexture("Texture", m_pTexture[0]);
                m_pEffect-&gt;CommitChanges();
                // Draw the mesh subset
                m_pStaticBall-&gt;DrawSubset(2);
            }
            // End the pass
            m_pEffect-&gt;EndPass();
        }// Loop Ends

        worldMat = Object[5].toWorldXForm;
        D3DXMatrixInverse(&amp;WITMat, 0, &amp;worldMat);
        D3DXMatrixTranspose(&amp;WITMat, &amp;WITMat);
        //m_pEffect-&gt;SetMatrix("worldViewProjMat", &amp;(worldMat * m_viewMat * m_projMat));
        //m_pEffect-&gt;SetMatrix("worldInverseTransposeMat", &amp;WITMat);
        //m_pEffect-&gt;SetMatrix("worldMat", &amp;worldMat);

            m_pEffect-&gt;SetMatrix("Projection", &amp;m_projMat);
            m_pEffect-&gt;SetMatrix("World", &amp;worldMat);
            m_pEffect-&gt;SetMatrix("View", &amp;m_viewMat);
            m_pEffect-&gt;SetFloatArray("DiffuseLightDirection",(float*)&amp;m_Light.Position, 3);
            m_pEffect-&gt;SetFloat("LineThickness", 0.2f);
            m_pEffect-&gt;SetFloat("DiffuseIntensity", 3.0f);


        for(int i=0; i &lt; pass; i++)
        {   
            // Begin the pass
            m_pEffect-&gt;BeginPass(i);
            //
            for (DWORD i = 0; i &lt; m_numMaterials; ++i) 
            {
                m_pEffect-&gt;SetValue("DiffuseColor",
                    &amp;meshMaterials[i].Diffuse, sizeof(D3DXCOLOR));
                if( meshTextures[i] != 0)
                {
                    m_pEffect-&gt;SetTexture("Texture", meshTextures[i]);
                }
                // But if not, then set a pure white texture.  When the texture color
                // is multiplied by the color from lighting, it is like multiplying by
                // 1 and won't change the color from lighting.
                else
                {
                    m_pEffect-&gt;SetTexture("Texture", m_pTexture[5]);
                }
                // After setting object specific parameters, commit changes 
                //m_pEffectToon-&gt;SetTexture("Texture", m_pTexture[0]);
                m_pEffect-&gt;CommitChanges();
                // Draw the mesh subset
                m_pStaticBall-&gt;DrawSubset(2);
            }
            // End the pass
            m_pEffect-&gt;EndPass();
        }// Loop Ends


        worldMat = Object[6].toWorldXForm;
        D3DXMatrixInverse(&amp;WITMat, 0, &amp;worldMat);
        D3DXMatrixTranspose(&amp;WITMat, &amp;WITMat);
        //m_pEffect-&gt;SetMatrix("worldViewProjMat", &amp;(worldMat * m_viewMat * m_projMat));
        //m_pEffect-&gt;SetMatrix("worldInverseTransposeMat", &amp;WITMat);
        //m_pEffect-&gt;SetMatrix("worldMat", &amp;worldMat);

            m_pEffect-&gt;SetMatrix("Projection", &amp;m_projMat);
            m_pEffect-&gt;SetMatrix("World", &amp;worldMat);
            m_pEffect-&gt;SetMatrix("View", &amp;m_viewMat);
            m_pEffect-&gt;SetFloatArray("DiffuseLightDirection",(float*)&amp;m_Light.Position, 3);
            m_pEffect-&gt;SetFloat("LineThickness", 0.2f);
            m_pEffect-&gt;SetFloat("DiffuseIntensity", 3.0f);


        for(int i=0; i &lt; pass; i++)
        {   
            // Begin the pass
            m_pEffect-&gt;BeginPass(i);
            //
            for (DWORD i = 0; i &lt; m_numMaterials; ++i) 
            {
                m_pEffect-&gt;SetValue("DiffuseColor",
                    &amp;meshMaterials[i].Diffuse, sizeof(D3DXCOLOR));
                if( meshTextures[i] != 0)
                {
                    m_pEffect-&gt;SetTexture("Texture", meshTextures[i]);
                }
                // But if not, then set a pure white texture.  When the texture color
                // is multiplied by the color from lighting, it is like multiplying by
                // 1 and won't change the color from lighting.
                else
                {
                    m_pEffect-&gt;SetTexture("Texture", m_pTexture[6]);
                }
                // After setting object specific parameters, commit changes 
                //m_pEffectToon-&gt;SetTexture("Texture", m_pTexture[0]);
                m_pEffect-&gt;CommitChanges();
                // Draw the mesh subset
                m_pStaticBall-&gt;DrawSubset(2);
            }
            // End the pass
            m_pEffect-&gt;EndPass();
        }// Loop Ends

        worldMat = Object[7].toWorldXForm;
        D3DXMatrixInverse(&amp;WITMat, 0, &amp;worldMat);
        D3DXMatrixTranspose(&amp;WITMat, &amp;WITMat);
        //m_pEffect-&gt;SetMatrix("worldViewProjMat", &amp;(worldMat * m_viewMat * m_projMat));
        //m_pEffect-&gt;SetMatrix("worldInverseTransposeMat", &amp;WITMat);
        //m_pEffect-&gt;SetMatrix("worldMat", &amp;worldMat);

            m_pEffect-&gt;SetMatrix("Projection", &amp;m_projMat);
            m_pEffect-&gt;SetMatrix("World", &amp;worldMat);
            m_pEffect-&gt;SetMatrix("View", &amp;m_viewMat);
            m_pEffect-&gt;SetFloatArray("DiffuseLightDirection",(float*)&amp;m_Light.Position, 3);
            m_pEffect-&gt;SetFloat("LineThickness", 0.2f);
            m_pEffect-&gt;SetFloat("DiffuseIntensity", 3.0f);


        for(int i=0; i &lt; pass; i++)
        {   
            // Begin the pass
            m_pEffect-&gt;BeginPass(i);
            //
            for (DWORD i = 0; i &lt; m_numMaterials; ++i) 
            {
                m_pEffect-&gt;SetValue("DiffuseColor",
                    &amp;meshMaterials[i].Diffuse, sizeof(D3DXCOLOR));
                if( meshTextures[i] != 0)
                {
                    m_pEffect-&gt;SetTexture("Texture", meshTextures[i]);
                }
                // But if not, then set a pure white texture.  When the texture color
                // is multiplied by the color from lighting, it is like multiplying by
                // 1 and won't change the color from lighting.
                else
                {
                    m_pEffect-&gt;SetTexture("Texture", m_pTexture[7]);
                }
                // After setting object specific parameters, commit changes 
                //m_pEffectToon-&gt;SetTexture("Texture", m_pTexture[0]);
                m_pEffect-&gt;CommitChanges();
                // Draw the mesh subset
                m_pStaticBall-&gt;DrawSubset(2);
            }
            // End the pass
            m_pEffect-&gt;EndPass();
        }// Loop Ends

        worldMat = Object[8].toWorldXForm;
        D3DXMatrixInverse(&amp;WITMat, 0, &amp;worldMat);
        D3DXMatrixTranspose(&amp;WITMat, &amp;WITMat);
        //m_pEffect-&gt;SetMatrix("worldViewProjMat", &amp;(worldMat * m_viewMat * m_projMat));
        //m_pEffect-&gt;SetMatrix("worldInverseTransposeMat", &amp;WITMat);
        //m_pEffect-&gt;SetMatrix("worldMat", &amp;worldMat);

            m_pEffect-&gt;SetMatrix("Projection", &amp;m_projMat);
            m_pEffect-&gt;SetMatrix("World", &amp;worldMat);
            m_pEffect-&gt;SetMatrix("View", &amp;m_viewMat);
            m_pEffect-&gt;SetFloatArray("DiffuseLightDirection",(float*)&amp;m_Light.Position, 3);
            m_pEffect-&gt;SetFloat("LineThickness", 0.2f);
            m_pEffect-&gt;SetFloat("DiffuseIntensity", 3.0f);


        for(int i=0; i &lt; pass; i++)
        {   
            // Begin the pass
            m_pEffect-&gt;BeginPass(i);
            //
            for (DWORD i = 0; i &lt; m_numMaterials; ++i) 
            {
                m_pEffect-&gt;SetValue("DiffuseColor",
                    &amp;meshMaterials[i].Diffuse, sizeof(D3DXCOLOR));
                if( meshTextures[i] != 0)
                {
                    m_pEffect-&gt;SetTexture("Texture", meshTextures[i]);
                }
                // But if not, then set a pure white texture.  When the texture color
                // is multiplied by the color from lighting, it is like multiplying by
                // 1 and won't change the color from lighting.
                else
                {
                    m_pEffect-&gt;SetTexture("Texture", m_pTexture[8]);
                }
                // After setting object specific parameters, commit changes 
                //m_pEffectToon-&gt;SetTexture("Texture", m_pTexture[0]);
                m_pEffect-&gt;CommitChanges();
                // Draw the mesh subset
                m_pStaticBall-&gt;DrawSubset(2);
            }
            // End the pass
            m_pEffect-&gt;EndPass();
        }// Loop Ends


        worldMat = Object[9].toWorldXForm;
        D3DXMatrixInverse(&amp;WITMat, 0, &amp;worldMat);
        D3DXMatrixTranspose(&amp;WITMat, &amp;WITMat);
        //m_pEffect-&gt;SetMatrix("worldViewProjMat", &amp;(worldMat * m_viewMat * m_projMat));
        //m_pEffect-&gt;SetMatrix("worldInverseTransposeMat", &amp;WITMat);
        //m_pEffect-&gt;SetMatrix("worldMat", &amp;worldMat);

            m_pEffect-&gt;SetMatrix("Projection", &amp;m_projMat);
            m_pEffect-&gt;SetMatrix("World", &amp;worldMat);
            m_pEffect-&gt;SetMatrix("View", &amp;m_viewMat);
            m_pEffect-&gt;SetFloatArray("DiffuseLightDirection",(float*)&amp;m_Light.Position, 3);
            m_pEffect-&gt;SetFloat("LineThickness", 0.2f);
            m_pEffect-&gt;SetFloat("DiffuseIntensity", 3.0f);


        for(int i=0; i &lt; pass; i++)
        {   
            // Begin the pass
            m_pEffect-&gt;BeginPass(i);
            //
            for (DWORD i = 0; i &lt; m_numMaterials; ++i) 
            {
                m_pEffect-&gt;SetValue("DiffuseColor",
                    &amp;meshMaterials[i].Diffuse, sizeof(D3DXCOLOR));
                if( meshTextures[i] != 0)
                {
                    m_pEffect-&gt;SetTexture("Texture", meshTextures[i]);
                }
                // But if not, then set a pure white texture.  When the texture color
                // is multiplied by the color from lighting, it is like multiplying by
                // 1 and won't change the color from lighting.
                else
                {
                    m_pEffect-&gt;SetTexture("Texture", m_pTexture[9]);
                }
                // After setting object specific parameters, commit changes 
                //m_pEffectToon-&gt;SetTexture("Texture", m_pTexture[0]);
                m_pEffect-&gt;CommitChanges();
                // Draw the mesh subset
                m_pStaticBall-&gt;DrawSubset(2);
            }
            // End the pass
            m_pEffect-&gt;EndPass();
        }// Loop Ends
    #pragma endregion draw world

}

void PlanetClass::ShutDown()
{

    SAFE_RELEASE(mTex0);
    SAFE_RELEASE(m_pEffectError);
    SAFE_RELEASE(m_pEffect);
}
</code></pre>
