It's nice to know that someone is keeping up to date with this project. Updates are pretty infrequent but I'm working on some interesting scripting stuff

It's probably because I'd already fixed one of two errors and so some of the patch became invalid.PolyVox wrote:Ok, thanks, I have made these changes. You might want to check them as the patch wouldn't apply (I don't understand why - it just said error at line 5) so I did it manually.
Maybe... but I'd just have expected SVN to flag conflicts in that case. Strange, but not too important.milliams wrote:It's probably because I'd already fixed one of two errors and so some of the patch became invalid.PolyVox wrote:Ok, thanks, I have made these changes. You might want to check them as the patch wouldn't apply (I don't understand why - it just said error at line 5) so I did it manually.
Probably my fault, pasting text from gedit introduces additonal lines in the code block tags which I tried to manually remove.PolyVox wrote:Maybe... but I'd just have expected SVN to flag conflicts in that case. Strange, but not too important.milliams wrote:It's probably because I'd already fixed one of two errors and so some of the patch became invalid.PolyVox wrote:Ok, thanks, I have made these changes. You might want to check them as the patch wouldn't apply (I don't understand why - it just said error at line 5) so I did it manually.
Yep, thanks. I've fixed thatdermont wrote:You probably also need to update your CMake/Demos build for the Linux plugins*.cfg files (as per the EngineTest).
The Demo/CMakeLists.txt / plugings*.in template files appear to set up for Windows only.
Code: Select all
mFPSDialog = new FPSDialog(mOgreWidget, Qt::ToolTip);
Code: Select all
mFPSDialog = new FPSDialog(mOgreWidget, Qt::FramelessWindowHint);
Ok, that doesn't seem to do any harm so I've commited it. Longer term I need to do a bit of a rewrite here, a it's a bit silly that you can drag the main window away from under the FPS widget.RenCheng wrote:I would recommendCode: Select all
mFPSDialog = new FPSDialog(mOgreWidget, Qt::ToolTip);
rather thanso that the FPS dialog will not get the window focus automatically.Code: Select all
mFPSDialog = new FPSDialog(mOgreWidget, Qt::FramelessWindowHint);
Hard to say from what you posted... can you also post the call stack? You might also want to break when exceptions are thrown via Debug->Exceptions->Check all the boxes. And is there anything in the log files (search for *.html files)?v_i_p wrote:Hi,
I cant run your demo application. When running, it gets an exception, then debugger points to "iosfwd" file to this row:
.
.
.
any help is appreciated.
And another problem about FPS window is that in fullscreen mode, the FPS window cannot been seen:)PolyVox wrote:Ok, that doesn't seem to do any harm so I've commited it. Longer term I need to do a bit of a rewrite here, a it's a bit silly that you can drag the main window away from under the FPS widget.RenCheng wrote:I would recommendCode: Select all
mFPSDialog = new FPSDialog(mOgreWidget, Qt::ToolTip);
rather thanso that the FPS dialog will not get the window focus automatically.Code: Select all
mFPSDialog = new FPSDialog(mOgreWidget, Qt::FramelessWindowHint);
Probably left, top, height, and width, which according to the ogre docs should be 0,0,1,1 in order to fill the window. Have a look here. But I'm really guessing here and in someways it doesn't feel like a viewport problem. Maybe also check the window flags which you are using as maybe they need to be differnt for MDI in order to allow proper repainting?pra wrote:Well, which values might help?
Good point, I guess you are just stuck with printing debug messages.pra wrote:Also, I have no idea how and where to set the breakpoint, since the window is being "cleaned" by anything in front of it (so changing into VC++ and then back will definitely break the error).
I Tried setting it to both the orge widget itself and the mdiSubWindow, no effect. Or almost no effect. Usually, the error occures when I open a level from the main menu (the app this stuff is part of is an editor), and this rectangle is where the "open level" dialog has been. So, when I set this attribute, the first time I open a level, the render window is redrawn like it should, but after that everything is back to "normal".Indicates that the widget paints all its pixels when it receives a paint event. It is thus not required for operations like updating, resizing, scrolling and focus changes to call erase the widget before generating paint events. Using WA_OpaquePaintEvent is a small optimization. It can help to reduce flicker on systems that do not provide double buffer support, and it avoids the computational cycles necessary to erase the background prior to paint. Note: Unlike WA_NoSystemBackground, WA_OpaquePaintEvent makes an effort to avoid transparent window backgrounds. This is set/cleared by the widget's author.
Code: Select all
#ifndef OGREENGINELOGIC_H_
#define OGREENGINELOGIC_H_
//#include "ChooseMeshWidget.h"
#include "GameLogic.h"
//#include "MainMenu.h"
#include <OgrePrerequisites.h>
#include <qhash.h>
#include <qpoint.h>
#include <QTime>
namespace QtOgre
{
enum KeyStates
{
KS_RELEASED,
KS_PRESSED
};
class StyleSettingsWidget;
class OgreEngineLogic : public GameLogic
{
public:
OgreEngineLogic(void);
void initialise(void);
void update(void);
void shutdown(void);
void onKeyPress(QKeyEvent* event);
void onKeyRelease(QKeyEvent* event);
void onMouseMove(QMouseEvent* event);
void onMousePress(QMouseEvent* event);
void onWheel(QWheelEvent* event);
// QtOgre::Log* demoLog(void);
void loadScene(QString filename);
private:
QHash<int, KeyStates> mKeyStates;
QPoint mLastFrameMousePos;
QPoint mCurrentMousePos;
int mLastFrameWheelPos;
int mCurrentWheelPos;
QTime* mTime;
int mLastFrameTime;
int mCurrentTime;
bool mIsFirstFrame;
float mCameraSpeed;
//ChooseMeshWidget* mChooseMeshWidget;
//MainMenu* mMainMenu;
StyleSettingsWidget* mStyleSettingsWidget;
Ogre::Camera* mCamera;
Ogre::SceneManager* mSceneManager;
// QtOgre::Log* mDemoLog;
};
}
#endif /*OGREENGINELOGIC_H_*/
Code: Select all
#include "OgreEngineLogic.h"
#include "DotSceneHandler.h"
//#include "MainMenu.h"
//#include "LogManager.h"
#include "OgreWidget.h"
//#include "StyleSettingsWidget.h"
#include <OgreEntity.h>
#include <OgreRenderWindow.h>
#include <OgreResourceGroupManager.h>
#include <OgreRoot.h>
#include <QKeyEvent>
#include <QMouseEvent>
#include <QSettings>
namespace QtOgre
{
OgreEngineLogic::OgreEngineLogic(void)
:GameLogic()
{
}
void OgreEngineLogic::initialise(void)
{
//qApp->setStyleSheet(qApp->settings()->value("UI/StyleFile").toString());
//mDemoLog = mApplication->createLog("Demo");
//mApplication->showLogManager();
/*
mDemoLog->logMessage("A demonstration debug message", LL_DEBUG);
mDemoLog->logMessage("A demonstration info message", LL_INFO);
mDemoLog->logMessage("A demonstration warning message", LL_WARNING);
mDemoLog->logMessage("A demonstration error message", LL_ERROR);*/
//Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
// Create the generic scene manager
mSceneManager = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC, "GenericSceneManager");
//Set up scene
loadScene("media/scenes/test.scene");
mApplication->ogreRenderWindow()->addViewport(mCamera)->setBackgroundColour(Ogre::ColourValue::Black);
mSceneManager->setAmbientLight( Ogre::ColourValue( 1, 1, 1 ) );
//Create the MainMenu
/* mMainMenu = new MainMenu(qApp, qApp->mainWidget());*/
//Create widget to choose between models
//mChooseMeshWidget = new ChooseMeshWidget(mJaiquaEntity, mRobotEntity, qApp->mainWidget());
//mChooseMeshWidget->setWindowOpacity(qApp->settings()->value("System/DefaultWindowOpacity", 1.0).toDouble());
//mChooseMeshWidget->move(qApp->mainWidget()->geometry().left() + qApp->mainWidget()->geometry().width() - mChooseMeshWidget->frameGeometry().width() - 10, qApp->mainWidget()->geometry().top() + 10);
//mChooseMeshWidget->show();
mTime = new QTime;
mTime->start();
mIsFirstFrame = true;
mCameraSpeed = 10.0;
for (Ogre::SceneManager::MovableObjectIterator moi = mSceneManager->getMovableObjectIterator("Entity"); moi.hasMoreElements(); moi.moveNext())
{
Ogre::Entity *entity = static_cast<Ogre::Entity*>(moi.peekNextValue());
Ogre::AnimationStateSet* animationStateSet = entity->getAllAnimationStates();
if(animationStateSet && animationStateSet->hasAnimationState("Walk"))
{
Ogre::AnimationState* walkAnimationState = animationStateSet->getAnimationState("Walk");
walkAnimationState->setLoop(true);
walkAnimationState->setEnabled(true);
}
}
//mApplication->showFPSCounter();
//
//mStyleSettingsWidget = new StyleSettingsWidget;
//mApplication->addSettingsWidget("Style", mStyleSettingsWidget);
}
void OgreEngineLogic::update(void)
{
mLastFrameTime = mCurrentTime;
mCurrentTime = mTime->elapsed();
float timeElapsedInSeconds = (mCurrentTime - mLastFrameTime) / 1000.0f;
for (Ogre::SceneManager::MovableObjectIterator moi = mSceneManager->getMovableObjectIterator("Entity"); moi.hasMoreElements(); moi.moveNext())
{
Ogre::Entity *entity = static_cast<Ogre::Entity*>(moi.peekNextValue());
Ogre::AnimationStateSet* animationStateSet = entity->getAllAnimationStates();
if(animationStateSet && animationStateSet->hasAnimationState("Walk"))
{
Ogre::AnimationState* walkAnimationState = animationStateSet->getAnimationState("Walk");
walkAnimationState->addTime(timeElapsedInSeconds);
}
}
float distance = mCameraSpeed * timeElapsedInSeconds;
if(mKeyStates[Qt::Key_W] == KS_PRESSED)
{
mCamera->setPosition(mCamera->getPosition() + mCamera->getDirection() * distance);
}
if(mKeyStates[Qt::Key_S] == KS_PRESSED)
{
mCamera->setPosition(mCamera->getPosition() - mCamera->getDirection() * distance);
}
if(mKeyStates[Qt::Key_A] == KS_PRESSED)
{
mCamera->setPosition(mCamera->getPosition() - mCamera->getRight() * distance);
}
if(mKeyStates[Qt::Key_D] == KS_PRESSED)
{
mCamera->setPosition(mCamera->getPosition() + mCamera->getRight() * distance);
}
if(!mIsFirstFrame)
{
QPoint mouseDelta = mCurrentMousePos - mLastFrameMousePos;
mCamera->yaw(Ogre::Radian(-mouseDelta.x() * timeElapsedInSeconds));
mCamera->pitch(Ogre::Radian(-mouseDelta.y() * timeElapsedInSeconds));
int wheelDelta = mCurrentWheelPos - mLastFrameWheelPos;
Ogre::Radian fov = mCamera->getFOVy();
fov += Ogre::Radian(-wheelDelta * 0.001);
fov = (std::min)(fov, Ogre::Radian(2.0f));
fov = (std::max)(fov, Ogre::Radian(0.5f));
mCamera->setFOVy(fov);
}
mLastFrameMousePos = mCurrentMousePos;
mLastFrameWheelPos = mCurrentWheelPos;
mIsFirstFrame = false;
}
void OgreEngineLogic::shutdown(void)
{
mSceneManager->clearScene();
Ogre::Root::getSingleton().destroySceneManager(mSceneManager);
}
void OgreEngineLogic::onKeyPress(QKeyEvent* event)
{
mKeyStates[event->key()] = KS_PRESSED;
if(event->key() == Qt::Key_Escape)
{
//qApp->centerWidget(mMainMenu, qApp->mMainWindow);
//mMainMenu->exec();
}
}
void OgreEngineLogic::onKeyRelease(QKeyEvent* event)
{
mKeyStates[event->key()] = KS_RELEASED;
}
void OgreEngineLogic::onMousePress(QMouseEvent* event)
{
mCurrentMousePos = event->pos();
mLastFrameMousePos = mCurrentMousePos;
}
void OgreEngineLogic::onMouseMove(QMouseEvent* event)
{
mCurrentMousePos = event->pos();
}
void OgreEngineLogic::onWheel(QWheelEvent* event)
{
mCurrentWheelPos += event->delta();
}
//Log* OgreEngineLogic::demoLog(void)
//{
// return mDemoLog;
//}
void OgreEngineLogic::loadScene(QString filename)
{
//The QtOgre DotScene loading code will clear the existing scene except for cameras, as these
//could be used by existing viewports. Therefore we clear and viewports and cameras before
//calling the loading code.
mApplication->ogreRenderWindow()->removeAllViewports();
mSceneManager->destroyAllCameras();
//Now load the scene.
DotSceneHandler handler(mSceneManager);
QXmlSimpleReader reader;
reader.setContentHandler(&handler);
reader.setErrorHandler(&handler);
QFile file(filename);
file.open(QFile::ReadOnly | QFile::Text);
QXmlInputSource xmlInputSource(&file);
reader.parse(xmlInputSource);
//Now create a viewport, using the first camera in the scene.
mCamera = mSceneManager->getCameraIterator().peekNextValue();
//mCamera->setPosition(0, 0, 20);
//mCamera->lookAt(0, 0, 0);
mCamera->setNearClipDistance(1.0);
mCamera->setFarClipDistance(1000.0);
//mCamera->setFOVy(Ogre::Radian(1.0f));
Ogre::Viewport* viewport = mApplication->ogreRenderWindow()->addViewport(mCamera);
viewport->setBackgroundColour(Ogre::ColourValue::Black);
}
}
Code: Select all
Error 1 error C2027: use of undefined type 'QtOgre::Application' E:\workspace\QTProjects\generat0rX\generat0rX\src\ogreEngineLogic.cpp 45 1 generat0rX
Error 2 error C2227: left of '->ogreRenderWindow' must point to class/struct/union/generic type E:\workspace\QTProjects\generat0rX\generat0rX\src\ogreEngineLogic.cpp 45 1 generat0rX
Error 3 error C2227: left of '->addViewport' must point to class/struct/union/generic type E:\workspace\QTProjects\generat0rX\generat0rX\src\ogreEngineLogic.cpp 45 1 generat0rX
Error 4 error C2227: left of '->setBackgroundColour' must point to class/struct/union/generic type E:\workspace\QTProjects\generat0rX\generat0rX\src\ogreEngineLogic.cpp 45 1 generat0rX
Error 5 error C2027: use of undefined type 'QtOgre::Application' E:\workspace\QTProjects\generat0rX\generat0rX\src\ogreEngineLogic.cpp 191 1 generat0rX
Error 6 error C2227: left of '->ogreRenderWindow' must point to class/struct/union/generic type E:\workspace\QTProjects\generat0rX\generat0rX\src\ogreEngineLogic.cpp 191 1 generat0rX
Error 7 error C2227: left of '->removeAllViewports' must point to class/struct/union/generic type E:\workspace\QTProjects\generat0rX\generat0rX\src\ogreEngineLogic.cpp 191 1 generat0rX
Error 8 error C2027: use of undefined type 'QtOgre::Application' E:\workspace\QTProjects\generat0rX\generat0rX\src\ogreEngineLogic.cpp 214 1 generat0rX
Error 9 error C2227: left of '->ogreRenderWindow' must point to class/struct/union/generic type E:\workspace\QTProjects\generat0rX\generat0rX\src\ogreEngineLogic.cpp 214 1 generat0rX
Error 10 error C2227: left of '->addViewport' must point to class/struct/union/generic type E:\workspace\QTProjects\generat0rX\generat0rX\src\ogreEngineLogic.cpp 214 1 generat0rX
It looks like it can't find the definition of QtOgre::Application. Can you try including 'Application.h' from OgreEngineLogic.cpp/h?mboeni wrote: currently gives me:Code: Select all
Error 1 error C2027: use of undefined type 'QtOgre::Application' E:\workspace\QTProjects\generat0rX\generat0rX\src\ogreEngineLogic.cpp 45 1 generat0rX . .