|
|
@ -172,38 +172,6 @@ bool OgreInitialize() |
|
|
|
g_ogreRoot->setRenderSystem(renderSystem); |
|
|
|
g_window = g_ogreRoot->initialise(/*autoCreateWindow=*/true, "GameLib"); |
|
|
|
|
|
|
|
// Old bad attempt at Ogre within SFML (only party worked)
|
|
|
|
{ |
|
|
|
// Ogre::NameValuePairList windowSettings;
|
|
|
|
// unsigned long winHandle = reinterpret_cast<unsigned
|
|
|
|
// long>(win.getBase()->getSystemHandle()); #ifdef _WIN32 unsigned long winGlContext =
|
|
|
|
// reinterpret_cast<unsigned long>(wglGetCurrentContext());
|
|
|
|
|
|
|
|
// windowSettings["externalWindowHandle"] = StringConverter::toString(winHandle);
|
|
|
|
// windowSettings["externalGLContext"] = StringConverter::toString(winGlContext);
|
|
|
|
// windowSettings["externalGLControl"] = String("True");
|
|
|
|
// #else
|
|
|
|
// // Deprecated. See
|
|
|
|
// ogre-next/RenderSystems/GL3Plus/src/windowing/GLX/OgreGLXWindow.cpp:237
|
|
|
|
// // windowSettings["externalWindowHandle"] = StringConverter::toString(winHandle);
|
|
|
|
// windowSettings["parentWindowHandle"] = StringConverter::toString(winHandle);
|
|
|
|
// // sf::Context context;
|
|
|
|
// // unsigned long activeContextId = (unsigned long)context.getActiveContextId();
|
|
|
|
// windowSettings["currentGLContext"] = String("True");
|
|
|
|
// // windowSettings["currentGLContext"] = StringConverter::toString(activeContextId);
|
|
|
|
// // windowSettings["externalGLControl"] = String("True");
|
|
|
|
// #endif
|
|
|
|
|
|
|
|
// int winWidth = 1920;
|
|
|
|
// int winHeight = 1080;
|
|
|
|
|
|
|
|
// Window* window =
|
|
|
|
// // g_ogreRoot->createRenderWindow("GameLib", winWidth, winHeight, true, &windowSettings);
|
|
|
|
// g_ogreRoot->createRenderWindow("GameLib", winWidth, winHeight, true);
|
|
|
|
|
|
|
|
// g_window->_setVisible(true);
|
|
|
|
} |
|
|
|
|
|
|
|
registerHlms(); |
|
|
|
|
|
|
|
// Create SceneManager
|
|
|
@ -233,57 +201,6 @@ bool OgreInitialize() |
|
|
|
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("data/Models", "FileSystem", |
|
|
|
"Models"); |
|
|
|
|
|
|
|
// Mesh importing
|
|
|
|
if (false) |
|
|
|
{ |
|
|
|
Ogre::v1::MeshPtr v1Mesh; |
|
|
|
Ogre::MeshPtr v2Mesh; |
|
|
|
// Load the v1 mesh. Notice the v1 namespace
|
|
|
|
// Also notice the HBU_STATIC flag; since the HBU_WRITE_ONLY
|
|
|
|
// bit would prohibit us from reading the data for importing.
|
|
|
|
v1Mesh = Ogre::v1::MeshManager::getSingleton().load( |
|
|
|
"Chassis.mesh", Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME, |
|
|
|
Ogre::v1::HardwareBuffer::HBU_STATIC, Ogre::v1::HardwareBuffer::HBU_STATIC); |
|
|
|
|
|
|
|
bool halfPosition = true; |
|
|
|
bool halfUVs = true; |
|
|
|
bool useQtangents = true; |
|
|
|
|
|
|
|
// Create a v2 mesh to import to, with a different name (arbitrary).
|
|
|
|
// Import the v1 mesh to v2
|
|
|
|
v2Mesh = Ogre::MeshManager::getSingleton().createByImportingV1( |
|
|
|
"Chassis.mesh Imported", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, |
|
|
|
v1Mesh.get(), halfPosition, halfUVs, useQtangents); |
|
|
|
|
|
|
|
// We don't need the v1 mesh. Free CPU memory, get it out of the GPU.
|
|
|
|
// Leave it loaded if you want to use athene with v1 Entity.
|
|
|
|
v1Mesh->unload(); |
|
|
|
|
|
|
|
// Create an Item with the model we just imported.
|
|
|
|
// Notice we use the name of the imported model. We could also use the overload
|
|
|
|
// with the mesh pointer:
|
|
|
|
// item = g_sceneManager->createItem( v2Mesh, Ogre::SCENE_DYNAMIC );
|
|
|
|
Ogre::Item* item = g_sceneManager->createItem( |
|
|
|
"Chassis.mesh Imported", Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME, |
|
|
|
Ogre::SCENE_DYNAMIC); |
|
|
|
// Ogre::SceneNode* rootSceneNode = g_sceneManager->getRootSceneNode(Ogre::SCENE_DYNAMIC);
|
|
|
|
Ogre::SceneNode* rootSceneNode = g_sceneManager->getRootSceneNode(); |
|
|
|
if (!rootSceneNode) |
|
|
|
{ |
|
|
|
return false; |
|
|
|
} |
|
|
|
// WTF - this should work, but it's almost like the root scene node's vtable is wrong
|
|
|
|
// Ogre::SceneNode* sceneNode = rootSceneNode->createChildSceneNode(Ogre::SCENE_DYNAMIC);
|
|
|
|
Ogre::SceneNode* sceneNode = static_cast<SceneNode*>( |
|
|
|
rootSceneNode->createChild()); // rootSceneNode->createChildSceneNode();
|
|
|
|
if (!sceneNode) |
|
|
|
{ |
|
|
|
return false; |
|
|
|
} |
|
|
|
sceneNode->attachObject(item); |
|
|
|
// sceneNode->scale( 0.1f, 0.1f, 0.1f );
|
|
|
|
} |
|
|
|
|
|
|
|
Ogre::WindowEventUtilities::addWindowEventListener(g_window, &g_myWindowEventListener); |
|
|
|
|
|
|
|
g_graphicsIntialized = true; |
|
|
|