[692] | 1 | /*
|
---|
| 2 | -----------------------------------------------------------------------------
|
---|
| 3 | This source file is part of OGRE
|
---|
| 4 | (Object-oriented Graphics Rendering Engine)
|
---|
| 5 | For the latest info, see http://www.ogre3d.org/
|
---|
| 6 |
|
---|
| 7 | Copyright (c) 2000-2005 The OGRE Team
|
---|
| 8 | Also see acknowledgements in Readme.html
|
---|
| 9 |
|
---|
| 10 | You may use this sample code for anything you like, it is not covered by the
|
---|
| 11 | LGPL like the rest of the engine.
|
---|
| 12 | -----------------------------------------------------------------------------
|
---|
| 13 | */
|
---|
| 14 |
|
---|
| 15 | /**
|
---|
| 16 | \file
|
---|
| 17 | SkyPlane.h
|
---|
| 18 | \brief
|
---|
| 19 | Specialisation of OGRE's framework application to show the
|
---|
| 20 | skyplane feature where a fixed constant-distance
|
---|
| 21 | skyplane is displayed in the background.
|
---|
| 22 | */
|
---|
| 23 |
|
---|
| 24 | #include "ExampleApplication.h"
|
---|
| 25 |
|
---|
| 26 | class SkyPlaneApplication : public ExampleApplication
|
---|
| 27 | {
|
---|
| 28 | public:
|
---|
| 29 | SkyPlaneApplication() {}
|
---|
| 30 |
|
---|
| 31 | protected:
|
---|
| 32 | // Just override the mandatory create scene method
|
---|
| 33 | void createScene(void)
|
---|
| 34 | {
|
---|
| 35 | // Set ambient light
|
---|
| 36 | mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5));
|
---|
| 37 |
|
---|
| 38 | // Define the required skyplane
|
---|
| 39 | Plane plane;
|
---|
| 40 | // 5000 world units from the camera
|
---|
| 41 | plane.d = 5000;
|
---|
| 42 | // Above the camera, facing down
|
---|
| 43 | plane.normal = -Vector3::UNIT_Y;
|
---|
| 44 | // Create the plane 10000 units wide, tile the texture 3 times
|
---|
| 45 | mSceneMgr->setSkyPlane(true, plane, "Examples/SpaceSkyPlane",10000,3);
|
---|
| 46 |
|
---|
| 47 | // Create a light
|
---|
| 48 | Light* l = mSceneMgr->createLight("MainLight");
|
---|
| 49 | // Accept default settings: point light, white diffuse, just set position
|
---|
| 50 | // NB I could attach the light to a SceneNode if I wanted it to move automatically with
|
---|
| 51 | // other objects, but I don't
|
---|
| 52 | l->setPosition(20,80,50);
|
---|
| 53 |
|
---|
| 54 | // Also add a nice dragon in
|
---|
| 55 | Entity *ent = mSceneMgr->createEntity("dragon", "dragon.mesh");
|
---|
| 56 | mSceneMgr->getRootSceneNode()->attachObject(ent);
|
---|
| 57 |
|
---|
| 58 |
|
---|
| 59 |
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | };
|
---|