Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

ktuluorion

Drawing an isometric map using directx graphics

This topic is 5762 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

For some reason the height is not working properly in this code.. if i take out the height part (the for loop with the c) it looks right. Any suggestions on how i can get the height working in my isometric map? I'm not sure, but it might have something to do with rotation, because when I don't rotate it and look at it straight on, it seems to work
    

int gameclass::render()
{

if( NULL == d3ddevice )
        return 1;
  d3ddevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, 
                         D3DCOLOR_XRGB(0,0,0), 1.0f, 0 );
d3ddevice->BeginScene();
setupmatrices(0,0,0);
static float r=0;
r+=.1f;
int heights[4][4]={2,1,2,3,
                   1,1,2,3,
				   1,1,2,3,
				   1,1,2,3};

for (int i =0;i<4;i++)
 for (int j=0;j<4;j++)
	for (int c=0;c<heights[i][j];c++)
	 rendermodel(block,j*2,c,i*2,-45.0f,0.0f,0.0f,1.0f);


d3ddevice->EndScene();
d3ddevice->Present(NULL,NULL,NULL,NULL);
return 0;
}


int gameclass::rendermodel(model mod,float x=0,float y=0,float z=0, float rx=0, float ry=0, float rz=0,float sc=0)
{  
    D3DXMATRIX matWorld,matTrans;
    
D3DXMatrixTransformation( &matTrans,NULL,NULL,NULL,NULL,NULL,
&D3DXVECTOR3(x,y,z));

D3DXMatrixRotationYawPitchRoll(&matWorld,rad(ry),rad(rx),rad(rz));

D3DXMatrixMultiply( &matWorld, &matWorld, &matTrans );

D3DXMatrixScaling( &matTrans,sc,sc,sc);
D3DXMatrixMultiply( &matWorld, &matWorld, &matTrans );

    d3ddevice->SetTransform( D3DTS_WORLD, &matWorld );
    
    


	
for( DWORD i=0; i<mod.num; i++ )
    {
        //Set the material and texture for this subset

        d3ddevice->SetMaterial( &mod.materials[i] );
        d3ddevice->SetTexture( 0, mod.textures[i] );
        
        //Draw the mesh subset

        mod.mesh->DrawSubset( i );
    }
return 0;
}
    
[edited by - ktuluorion on November 5, 2002 2:28:42 PM]

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!