3dxi to d3d camera conversions

Started by
1 comment, last by lucky6969b 12 years, 8 months ago
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


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());
}


}

Advertisement
You can use [font=Consolas, Courier, monospace][size=2]D3DXMatrixLookAtLH(...) command to create a view matrix and [/font][font=Consolas, Courier, monospace][size=2]D3DXMatrixPerspectiveFovLH(...) to create the projection matrix. [/font][font=Consolas, Courier, monospace][size=2]Those functions have variants so you'll have to look for the correct function.[/font]
[font=Consolas, Courier, monospace][size=2]
[/font]
[font=Consolas, Courier, monospace][size=2]Fov, FarClip and NearClip are data needed for the projection matrix.[/font]
[font=Consolas, Courier, monospace][size=2]
[/font]
[font=Consolas, Courier, monospace][size=2]Camera's position and target's position provide data for the view matrix.[/font]
[font=Consolas, Courier, monospace][size=2]
[/font]
[font=Consolas, Courier, monospace][size=2]Cheers![/font]
[font=Consolas, Courier, monospace][size=2]
[/font]
Alright, thanks, I might start to know what I am doing now.... :)
Jack

This topic is closed to new replies.

Advertisement