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 | EnvMapping.cpp
|
---|
18 | \brief
|
---|
19 | Specialisation of OGRE's framework application to show the
|
---|
20 | environment mapping feature.
|
---|
21 | */
|
---|
22 |
|
---|
23 | #include "ExampleApplication.h"
|
---|
24 |
|
---|
25 | class EnvMapApplication : public ExampleApplication
|
---|
26 | {
|
---|
27 | public:
|
---|
28 | EnvMapApplication() {}
|
---|
29 |
|
---|
30 | protected:
|
---|
31 |
|
---|
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 | // Create a point light
|
---|
39 | Light* l = mSceneMgr->createLight("MainLight");
|
---|
40 | // Accept default settings: point light, white diffuse, just set position
|
---|
41 | // NB I could attach the light to a SceneNode if I wanted it to move automatically with
|
---|
42 | // other objects, but I don't
|
---|
43 | l->setPosition(20,80,50);
|
---|
44 |
|
---|
45 |
|
---|
46 | Entity *ent = mSceneMgr->createEntity("head", "ogrehead.mesh");
|
---|
47 |
|
---|
48 |
|
---|
49 | // Set material loaded from Example.material
|
---|
50 | ent->setMaterialName("Examples/EnvMappedRustySteel");
|
---|
51 |
|
---|
52 | // Add entity to the root scene node
|
---|
53 | mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(ent);
|
---|
54 |
|
---|
55 |
|
---|
56 |
|
---|
57 |
|
---|
58 | }
|
---|
59 |
|
---|
60 | };
|
---|