Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/Samples/Smoke/include/Smoke.h @ 3

Last change on this file since 3 was 3, checked in by anonymous, 17 years ago

=update

File size: 2.4 KB
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4    (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2006 Torus Knot Software Ltd
8Also see acknowledgements in Readme.html
9
10You may use this sample code for anything you like, it is not covered by the
11LGPL like the rest of the engine.
12-----------------------------------------------------------------------------
13*/
14/*
15-----------------------------------------------------------------------------
16Filename:    ParticleApplication.cpp
17Description: Specialisation of OGRE's framework application to show the
18             environment mapping feature.
19-----------------------------------------------------------------------------
20*/
21
22
23#include "ExampleApplication.h"
24
25
26// Event handler to add ability to alter curvature
27class ParticleFrameListener : public ExampleFrameListener
28{
29protected:
30    SceneNode* mFountainNode;
31public:
32    ParticleFrameListener(RenderWindow* win, Camera* cam, SceneNode* fountainNode)
33        : ExampleFrameListener(win, cam)
34    {
35        mFountainNode = fountainNode;
36    }
37
38    bool frameStarted(const FrameEvent& evt)
39    {
40
41        // Rotate fountains
42//        mFountainNode->yaw(evt.timeSinceLastFrame * 30);
43
44        // Call default
45        return ExampleFrameListener::frameStarted(evt);
46
47    }
48};
49
50
51
52class ParticleApplication : public ExampleApplication
53{
54public:
55    ParticleApplication() {}
56
57protected:
58    SceneNode* mFountainNode;
59
60    // Just override the mandatory create scene method
61    void createScene(void)
62    {
63        // Set ambient light
64        mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5));
65
66        // Create a skydome
67        mSceneMgr->setSkyDome(true, "Examples/CloudySky", 5, 8);
68
69       
70        // Create shared node for 2 fountains
71        mFountainNode = static_cast<SceneNode*>(mSceneMgr->getRootSceneNode()->createChild());
72
73        // smoke
74        ParticleSystem* pSys2 = mSceneMgr->createParticleSystem("fountain1", 
75            "Examples/Smoke");
76        // Point the fountain at an angle
77        SceneNode* fNode = static_cast<SceneNode*>(mFountainNode->createChild());
78        fNode->attachObject(pSys2);
79
80    }
81
82    // Create new frame listener
83    void createFrameListener(void)
84    {
85        mFrameListener= new ParticleFrameListener(mWindow, mCamera, mFountainNode);
86        mRoot->addFrameListener(mFrameListener);
87    }
88
89
90};
91
Note: See TracBrowser for help on using the repository browser.