source: trunk/UPV/GTGeometry/tests/test_OgreImporter/src/main.cpp @ 138

Revision 138, 2.7 KB checked in by hidalgo, 19 years ago (diff)

Uploaded WP4 Dummy code(Geometry)

Line 
1/*****************************************************************************
2            --- EJEMPLO de uso del importador de mallas de OGRE ---
3------------------------------------------------------------------------------
4   Autor: Jose L. Hidalgo
5   Fecha: 24/04/2005
6
7******************************************************************************/
8
9//Headers:
10#include <Ogre.h>
11#include <ExampleApplication.h>
12#include <OgreGTGeometry.h>
13
14
15/*********************  Test Application  ************************************/
16
17class Application : public ExampleApplication
18{
19protected:
20        void createScene(void);
21        OgreGTGeometry ogreImporter;
22
23public:
24};
25
26
27void Application::createScene(void)
28{
29
30        // Original mesh
31        Ogre::String meshName("ogrehead.mesh");
32        Ogre::MeshPtr meshOriginal = Ogre::MeshManager::getSingleton().
33                load(meshName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
34       
35        // TRANSFORM !!!!
36        Geometry::Mesh *geoMesh = OgreGTGeometry::getSingleton().transform(meshOriginal.getPointer());
37        Ogre::MeshPtr  ogreMesh = OgreGTGeometry::getSingleton().transform(geoMesh, Ogre::String("nuevo"));
38       
39       
40        // Attach objects:
41        Ogre::Entity* thisEntity1 = mSceneMgr->createEntity("blah_1",meshName);
42        Ogre::Entity* thisEntity2 = mSceneMgr->createEntity("blah_2","nuevo");
43       
44        Ogre::SceneNode* thisSceneNode1 = static_cast<SceneNode*>(mSceneMgr->getRootSceneNode()->createChild());
45        Ogre::SceneNode* thisSceneNode2 = static_cast<SceneNode*>(mSceneMgr->getRootSceneNode()->createChild());
46        Ogre::Light *light = mSceneMgr->createLight("luz");
47
48        light->setPosition(0,200,0);
49        light->setDiffuseColour(Ogre::ColourValue());
50        mSceneMgr->setAmbientLight(Ogre::ColourValue(0.5,0.5,0.5));
51        mSceneMgr->setSkyDome(true,"Examples/CloudySky");
52       
53        Ogre::Vector3 pos(1,0,0);
54        pos *= ogreMesh->getBoundingSphereRadius();
55
56        thisSceneNode1->setPosition(pos);
57    thisSceneNode1->attachObject(thisEntity1);
58
59        thisSceneNode2->setPosition(-pos);
60    thisSceneNode2->attachObject(thisEntity2);
61}
62
63
64
65/*****************************************************************************/
66#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
67#define WIN32_LEAN_AND_MEAN
68#include "windows.h"
69
70INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
71#else
72int main(int argc, char **argv)
73#endif
74{
75    // Create application object
76    Application app;
77
78    try {
79        app.go();
80    } catch( Exception& e ) {
81#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
82        MessageBox( NULL, e.getFullDescription().c_str(),
83                        "An exception has occured!",
84                        MB_OK | MB_ICONERROR | MB_TASKMODAL);
85#else
86        fprintf(stderr, "An exception has occured: %s\n",
87                e.getFullDescription().c_str());
88#endif
89    }
90
91    return 0;
92}
Note: See TracBrowser for help on using the repository browser.