Progger
28-12-2008 22:06:51
Hi,
I'm using ETM with the GUI library wxWidgets but I have some problems to link these both libraries together.
I'm using almost the same code like in the demo.
The are two issues however:
1. The LOD construct works strange since the terrain is build of only few triangles. The camera should be moved very close to the terrain so that I can realize simple details (i.e. it works not in the same way like in the demo)
2. Deforming of the terrain works pretty slowly. I don't even see how it is deformed until I release the button that should deform the terrain.
Here a little bit of code:
This method is called after the mouse was moved and should deform the terrain. Not like in the demo with the both buttons but with relative mouse position. This works like mentioned above very slowly however
I hope you have already worked with wxWidgets and ETM successfully and can give me some tips
cu
I'm using ETM with the GUI library wxWidgets but I have some problems to link these both libraries together.
I'm using almost the same code like in the demo.
The are two issues however:
1. The LOD construct works strange since the terrain is build of only few triangles. The camera should be moved very close to the terrain so that I can realize simple details (i.e. it works not in the same way like in the demo)
2. Deforming of the terrain works pretty slowly. I don't even see how it is deformed until I release the button that should deform the terrain.
Here a little bit of code:
void MyWindow::OnMouseMotion(wxMouseEvent& wxEvent)
{
// determine the relative position of the mouse cursor
wxPoint vNewMousePos = wxEvent.GetPosition();
Ogre::Vector2 vMouseRelPos;
vMouseRelPos.x = static_cast<Ogre::Real>(vNewMousePos.x - m_vOldMousePos.x);
vMouseRelPos.y = static_cast<Ogre::Real>(vNewMousePos.y - m_vOldMousePos.y);
m_vOldMousePos = vNewMousePos;
// deform the terrain with the pressed left mouse button
if(wxEvent.m_leftDown && wxEvent.Dragging())
{
float fBrushIntensity = vMouseRelPos.y * 0.001f;
Ogre::Vector3 vDeformPos = m_pTerrainCursor->getPosition();
m_pTerrainMgr->deform(m_pTerrainInfo->posToVertexX(vDeformPos.x),
m_pTerrainInfo->posToVertexZ(vDeformPos.z),
m_EditBrush,
fBrushIntensity);
}
}
This method is called after the mouse was moved and should deform the terrain. Not like in the demo with the both buttons but with relative mouse position. This works like mentioned above very slowly however
I hope you have already worked with wxWidgets and ETM successfully and can give me some tips
cu