shanefarris
02-01-2011 00:20:46
I have my camera lookat set to 0, 0, 0, and I can load my scene with hydrax and it is rending, but if I move my camera up or down hydrax will disappear. If I change my lookat to 0, 1, 0 it doesn't show up, so something is wrong with how I am setting up my camera and viewport maybe? I don't have anything in my log telling me there's an issue with hydrax.
Here is how I am setting up my camera and viewport:
Then later I am setting the lookat
Has anyone ran into this issue before, or have any idea what the issue could be? Its not my graphics card, I can render the scene just find in Ogitor.
Thanks.
Here is how I am setting up my camera and viewport:
void CCameraManager::_CreateCamera(const char* Name, SceneNode* Parent)
{
// Create a default camera
if(!m_OgreCamera)
{
SceneManager* sm = CGameManager::Instance()->GetSceneManager();
m_OgreCamera = sm->createCamera("camera_main");
// Create the camera's node structure
if(Parent)
m_CameraNode = Parent;
else
m_CameraNode = sm->getRootSceneNode()->createChildSceneNode(Name);
String targetName = String(Name);
m_TargetNode = sm->getRootSceneNode()->createChildSceneNode(String(targetName + "_target").c_str());
// Attach the Ogre camera to the camera node
m_CameraNode->attachObject(m_OgreCamera);
m_OgreCamera->setNearClipDistance(1.0f);
m_OgreCamera->setAutoAspectRatio(true);
if (CGameManager::Instance()->GetEngineDevice()->getRenderSystem()->getCapabilities()->hasCapability(RSC_INFINITE_FAR_PLANE))
m_OgreCamera->setFarClipDistance(0);
else
m_OgreCamera->setFarClipDistance(1000);
}
}
void CCameraManager::SetupViewport()
{
if(!isViewportSetup)
{
if(m_OgreCamera)
{
// Setup viewport
u32 test = CGameManager::Instance()->GetRenderWindow()->getNumViewports();
if(CGameManager::Instance()->GetRenderWindow()->getNumViewports() == 0)
{
// Create one viewport, entire window
m_Viewport = CGameManager::Instance()->GetRenderWindow()->addViewport(m_OgreCamera);
m_Viewport->setBackgroundColour(ColourValue(0, 0, 0));
// Alter the camera aspect ratio to match the viewport
m_OgreCamera->setAspectRatio(f32(m_Viewport->getActualWidth()) / f32(m_Viewport->getActualHeight()));
}
else
{
m_Viewport->setCamera(m_OgreCamera);
}
// Alter the camera aspect ratio to match the viewport
m_OgreCamera->setAspectRatio(f32(m_Viewport->getActualWidth()) / f32(m_Viewport->getActualHeight()));
isViewportSetup = true;
}
}
}
Then later I am setting the lookat
m_Camera->lookAt(reVector3Df(0.0f, 1.0f, 10.0f));
// Default should be 0,0,0 otherwise its an offset to the player
m_Camera->setPosition(0.0f, 0.0f, 0.0f);
Has anyone ran into this issue before, or have any idea what the issue could be? Its not my graphics card, I can render the scene just find in Ogitor.
Thanks.