Commits

Fred...@Baator  committed 8fe708a

remove ExampleApplication files

  • Participants
  • Parent commits 3836dc4

Comments (0)

Files changed (3)

File ogre-lib3ds/ExampleLoadingBar.h

-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-(Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2006 Torus Knot Software Ltd
-Also see acknowledgements in Readme.html
-
-You may use this sample code for anything you like, it is not covered by the
-LGPL like the rest of the engine.
------------------------------------------------------------------------------
-*/
-/*
------------------------------------------------------------------------------
-Filename:    ExampleLoadingBar.h
-Description: Defines an example loading progress bar which you can use during 
-startup, level changes etc to display loading progress. 
-IMPORTANT: Note that this progress bar relies on you having the OgreCore.zip 
-package already added to a resource group called 'Bootstrap' - this provides
-the basic resources required for the progress bar and will be loaded automatically.
-*/
-#include "OgreResourceGroupManager.h"
-#include "OgreException.h"
-#include "OgreOverlay.h"
-#include "OgreOverlayManager.h"
-#include "OgreRenderWindow.h"
-
-using namespace Ogre;
-
-/** Defines an example loading progress bar which you can use during 
-	startup, level changes etc to display loading progress. 
-@remarks
-	Basically you just need to create an instance of this class, call start()
-	before loading and finish() afterwards. You may also need to stop areas of
-	your scene rendering in between since this method will call 
-	RenderWindow::update() to update the display of the bar - we advise using
-	SceneManager's 'special case render queues' for this, see
-	SceneManager::addSpecialCaseRenderQueue for details.
-@note 
-	This progress bar relies on you having the OgreCore.zip package already 
-	added to a resource group called 'Bootstrap' - this provides the basic 
-	resources required for the progress bar and will be loaded automatically.
-*/
-class ExampleLoadingBar : public ResourceGroupListener
-{
-protected:
-	RenderWindow* mWindow;
-	Overlay* mLoadOverlay;
-	Real mInitProportion;
-	unsigned short mNumGroupsInit;
-	unsigned short mNumGroupsLoad;
-	Real mProgressBarMaxSize;
-	Real mProgressBarScriptSize;
-	Real mProgressBarInc;
-	OverlayElement* mLoadingBarElement;
-	OverlayElement* mLoadingDescriptionElement;
-	OverlayElement* mLoadingCommentElement;
-
-public:
-	ExampleLoadingBar() {}
-	virtual ~ExampleLoadingBar(){}
-
-	/** Show the loading bar and start listening.
-	@param window The window to update 
-	@param numGroupsInit The number of groups you're going to be initialising
-	@param numGroupsLoad The number of groups you're going to be loading
-	@param initProportion The proportion of the progress which will be taken
-		up by initialisation (ie script parsing etc). Defaults to 0.7 since
-		script parsing can often take the majority of the time.
-	*/
-	virtual void start(RenderWindow* window, 
-		unsigned short numGroupsInit = 1, 
-		unsigned short numGroupsLoad = 1, 
-		Real initProportion = 0.70f)
-	{
-		mWindow = window;
-		mNumGroupsInit = numGroupsInit;
-		mNumGroupsLoad = numGroupsLoad;
-		mInitProportion = initProportion;
-		// We need to pre-initialise the 'Bootstrap' group so we can use
-		// the basic contents in the loading screen
-		ResourceGroupManager::getSingleton().initialiseResourceGroup("Bootstrap");
-
-		OverlayManager& omgr = OverlayManager::getSingleton();
-		mLoadOverlay = (Overlay*)omgr.getByName("Core/LoadOverlay");
-		if (!mLoadOverlay)
-		{
-			OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, 
-				"Cannot find loading overlay", "ExampleLoadingBar::start");
-		}
-		mLoadOverlay->show();
-
-		// Save links to the bar and to the loading text, for updates as we go
-		mLoadingBarElement = omgr.getOverlayElement("Core/LoadPanel/Bar/Progress");
-		mLoadingCommentElement = omgr.getOverlayElement("Core/LoadPanel/Comment");
-		mLoadingDescriptionElement = omgr.getOverlayElement("Core/LoadPanel/Description");
-
-		OverlayElement* barContainer = omgr.getOverlayElement("Core/LoadPanel/Bar");
-		mProgressBarMaxSize = barContainer->getWidth();
-		mLoadingBarElement->setWidth(0);
-
-		// self is listener
-		ResourceGroupManager::getSingleton().addResourceGroupListener(this);
-
-
-
-	}
-
-	/** Hide the loading bar and stop listening. 
-	*/
-	virtual void finish(void)
-	{
-		// hide loading screen
-		mLoadOverlay->hide();
-
-		// Unregister listener
-		ResourceGroupManager::getSingleton().removeResourceGroupListener(this);
-
-	}
-
-
-	// ResourceGroupListener callbacks
-	void resourceGroupScriptingStarted(const String& groupName, size_t scriptCount)
-	{
-		assert(mNumGroupsInit > 0 && "You stated you were not going to init "
-			"any groups, but you did! Divide by zero would follow...");
-		// Lets assume script loading is 70%
-		mProgressBarInc = mProgressBarMaxSize * mInitProportion / (Real)scriptCount;
-		mProgressBarInc /= mNumGroupsInit;
-		mLoadingDescriptionElement->setCaption("Parsing scripts...");
-		mWindow->update();
-	}
-	void scriptParseStarted(const String& scriptName, bool &skipThisScript)
-	{
-		mLoadingCommentElement->setCaption(scriptName);
-		mWindow->update();
-	}
-	void scriptParseEnded(const String& scriptName, bool skipped)
-	{
-		mLoadingBarElement->setWidth(
-			mLoadingBarElement->getWidth() + mProgressBarInc);
-		mWindow->update();
-	}
-	void resourceGroupScriptingEnded(const String& groupName)
-	{
-	}
-	void resourceGroupLoadStarted(const String& groupName, size_t resourceCount)
-	{
-		assert(mNumGroupsLoad > 0 && "You stated you were not going to load "
-			"any groups, but you did! Divide by zero would follow...");
-		mProgressBarInc = mProgressBarMaxSize * (1-mInitProportion) / 
-			(Real)resourceCount;
-		mProgressBarInc /= mNumGroupsLoad;
-		mLoadingDescriptionElement->setCaption("Loading resources...");
-		mWindow->update();
-	}
-	void resourceLoadStarted(const ResourcePtr& resource)
-	{
-		mLoadingCommentElement->setCaption(resource->getName());
-		mWindow->update();
-	}
-	void resourceLoadEnded(void)
-	{
-	}
-	void worldGeometryStageStarted(const String& description)
-	{
-		mLoadingCommentElement->setCaption(description);
-		mWindow->update();
-	}
-	void worldGeometryStageEnded(void)
-	{
-		mLoadingBarElement->setWidth(
-			mLoadingBarElement->getWidth() + mProgressBarInc);
-		mWindow->update();
-	}
-	void resourceGroupLoadEnded(const String& groupName)
-	{
-	}
-
-	Ogre::DataStreamPtr resourceLoading(const String &name, const String &group, Resource *resource)
-	{
-		return Ogre::DataStreamPtr();
-	}
-
-	bool resourceCollision(ResourcePtr &resource, ResourceManager *resourceManager)
-	{
-		return false;
-	}
-
-};
-

File ogre-lib3ds/Test3DSViewerApp.cpp

     mSceneMgr->setNormaliseNormalsOnScale(true);
     _createGrid(1000);
     _createLight();
-    /*mCamera->setPosition(100, 100, 100);
-    mCamera->lookAt(Vector3::ZERO);*/
+
 
     _build3dsModel();
-    //_buildRadiator();
-
-
-    
+    //_buildRadiator(); 
 }
 //------------------------------------------------------------------------------
 void Test3DSViewerApp::_build3dsModel()
     SceneNode *modelNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("3ds model");
  
     //m3dsFile =  lib3ds_file_open("../media/3ds/test3.3DS");
-    m3dsFile =  lib3ds_file_open("../media/3ds/indochine.3DS");
+    //m3dsFile =  lib3ds_file_open("../media/3ds/indochine.3DS");
     //m3dsFile =  lib3ds_file_open("../media/3ds/monaco.3DS");
     //m3dsFile =  lib3ds_file_open("../media/3ds/amphimath_walls.3DS");
-    //m3dsFile =  lib3ds_file_open("../media/3ds/lyon.3DS");
+    m3dsFile =  lib3ds_file_open("../media/3ds/lyon.3DS");
     //m3dsFile =  lib3ds_file_open("../media/3ds/Kengresshus-visuelle.3DS");
     //m3dsFile =  lib3ds_file_open("../media/3ds/casa_de_musica-visuelle.3DS");
     //m3dsFile =  lib3ds_file_open("../media/3ds/Modern-home-interior1.3DS");
     //_buildSubtree( m3dsFile->nodes, "/", modelNode);
 
 
+
+
     Real width = mAABB.getSize()[0];
     Real scale = 1000.0/width;
     modelNode->scale(scale, scale, scale);
     modelNode->pitch(Degree(-90));
 
+    StaticGeometry *geom = mSceneMgr->createStaticGeometry("fucking shit");
+    geom->addSceneNode(modelNode);
+    geom->build();
+    geom->setVisible(true);
+    modelNode->setVisible(false);
+
+
     lib3ds_file_free(m3dsFile);
  
 }
                     mMeshVect.push_back(newMesh);
                     mMeshes[newMesh->getName()] = newMesh;
 
-                    m3dsBuildLog->logMessage(boost::str(boost::format("attaching %s to node %s")% newMesh->getName() % fullName));
+                    m3dsBuildLog->logMessage(boost::str(boost::format("attaching %s to node %s")
+                                                            % newMesh->getName() % fullName));
                     Entity *ent = mSceneMgr->createEntity(fullName+" Ent", newMesh->getName());
 
                     newNode->attachObject(ent);
+
+                    {
+                        Ogre::Vector3 pos = ent->getParentSceneNode()->_getDerivedPosition();
+                        Ogre::Vector3 scale = ent->getParentSceneNode()->_getDerivedScale();
+                        Ogre::Quaternion rotation = ent->getParentSceneNode()->_getDerivedOrientation();
+
+                        const Ogre::Vector3 * corners = ent->getBoundingBox().getAllCorners();
+
+                        for (int i=0 ; i<8 ; i++)
+                        {
+                            mAABB.merge(pos + rotation * corners[i] * scale);
+                        }
+                    }
                 }
             }
             _buildSubtree(p->childs, fullName, newNode);
     memcpy(orig_vertices, mesh->vertices, sizeof(float) * 3 * mesh->nvertices);
     
     // create translated ogre manualobject
-    //{
+
         float inv_matrix[4][4], M[4][4];
         float tmp[3];
         //int i;
         lib3ds_mesh_calculate_vertex_normals(mesh, normals);
         
         // copy everything to vertex buffers
-        newObject->begin("Gray", RenderOperation::OT_TRIANGLE_LIST);
+        newObject->begin("3DS/Gray", RenderOperation::OT_TRIANGLE_LIST);
 
         int idx = 0;
 
 
         newObject->end();
         free(normals); 
-    //}
+
     //restore mesh for future use
     memcpy(mesh->vertices, orig_vertices, sizeof(float) * 3 * mesh->nvertices);
     free(orig_vertices);
     {
         // create ogre mesh from manualobject
         newMesh = newObject->convertToMesh(fullMeshName + ".mesh");
-        //newMesh->buildTangentVectors();
         mSceneMgr->destroyManualObject(newObject);
     }
     else
         lib3ds_mesh_calculate_vertex_normals(mesh, normals);
 
         // create an ogre object for easy OgreMesh conversion
-        // Gray = default material
         // TODO: better default material
         newObject->begin("3DS/Gray", RenderOperation::OT_TRIANGLE_LIST);
 
 
             m3dsBuildLog->logMessage("\n\n\n");
             
-            
-
+           
             _buildSceneFromNode(p->childs, newNode, fullName, _level+1, _show);
         }
     }

File ogre-lib3ds/ogre-lib3ds.vcproj

 			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
 			>
 			<File
-				RelativePath=".\ExampleApplication.h"
-				>
-			</File>
-			<File
-				RelativePath=".\ExampleFrameListener.h"
-				>
-			</File>
-			<File
-				RelativePath=".\ExampleLoadingBar.h"
-				>
-			</File>
-			<File
 				RelativePath=".\MovableText.h"
 				>
 			</File>