Sign in to follow this  
lucky6969b

3dxi to d3d camera conversions

Recommended Posts

Have to resort to 3dxi, just wondering how to construct a D3D Camera from the far/near clips etc parameters.
Anywhere I can look?
Thanks
Jack

[code]
void IGameExporter::DumpCamera(IGameCamera *ca, CComPtr<IXMLDOMNode> parent)
{

IGameProperty * prop;
CComPtr <IXMLDOMNode> propNode,targNode;


CreateXMLNode(pXMLDoc,parent,_T("Properties"),&propNode);
prop = ca->GetCameraFOV();
DumpProperties(propNode,prop);
prop = ca->GetCameraFarClip();
DumpProperties(propNode,prop);
prop = ca->GetCameraNearClip();
DumpProperties(propNode,prop);
prop = ca->GetCameraTargetDist();
DumpProperties(propNode,prop);

if(ca->GetCameraTarget())
{
CreateXMLNode(pXMLDoc,parent,_T("Target"),&targNode);
ExportChildNodeInfo(targNode,ca->GetCameraTarget());
}


}
[/code]

Share this post


Link to post
Share on other sites
You can use [font=Consolas, Courier, monospace][size=2]D3DXMatrixLookAtLH(...) command to create a view matrix and [/size][/font][font=Consolas, Courier, monospace][size=2]D3DXMatrixPerspectiveFovLH(...) to create the projection matrix. [/size][/font][font=Consolas, Courier, monospace][size=2]Those functions have variants so you'll have to look for the correct function.[/size][/font]
[font=Consolas, Courier, monospace][size=2]
[/size][/font]
[font=Consolas, Courier, monospace][size=2]Fov, FarClip and NearClip are data needed for the projection matrix.[/size][/font]
[font=Consolas, Courier, monospace][size=2]
[/size][/font]
[font=Consolas, Courier, monospace][size=2]Camera's position and target's position provide data for the view matrix.[/size][/font]
[font=Consolas, Courier, monospace][size=2]
[/size][/font]
[font=Consolas, Courier, monospace][size=2]Cheers![/size][/font]
[font=Consolas, Courier, monospace][size=2]
[/size][/font]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this