~ubuntu-branches/debian/sid/ember/sid

« back to all changes in this revision

Viewing changes to src/components/ogre/environment/hydrax/src/Noise/Noise.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michael Koch
  • Date: 2009-07-23 07:46:40 UTC
  • Revision ID: james.westby@ubuntu.com-20090723074640-wh0ukzis0kda36qv
Tags: upstream-0.5.6
Import upstream version 0.5.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
--------------------------------------------------------------------------------
 
3
This source file is part of Hydrax.
 
4
Visit ---
 
5
 
 
6
Copyright (C) 2008 Xavier Vergu�n Gonz�lez <xavierverguin@hotmail.com>
 
7
                                           <xavyiy@gmail.com>
 
8
 
 
9
This program is free software; you can redistribute it and/or modify it under
 
10
the terms of the GNU Lesser General Public License as published by the Free Software
 
11
Foundation; either version 2 of the License, or (at your option) any later
 
12
version.
 
13
 
 
14
This program is distributed in the hope that it will be useful, but WITHOUT
 
15
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
16
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
 
17
 
 
18
You should have received a copy of the GNU Lesser General Public License along with
 
19
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 
20
Place - Suite 330, Boston, MA 02111-1307, USA, or go to
 
21
http://www.gnu.org/copyleft/lesser.txt.
 
22
--------------------------------------------------------------------------------
 
23
*/
 
24
 
 
25
#include "Noise.h"
 
26
 
 
27
namespace Hydrax{namespace Noise
 
28
{
 
29
    Noise::Noise(const Ogre::String &Name, const bool& GPUNormalMapSupported)
 
30
                : mName(Name) 
 
31
            , mCreated(false)
 
32
                , mGPUNormalMapSupported(GPUNormalMapSupported)
 
33
                , mGPUNormalMapResourcesCreated(false)
 
34
        {
 
35
        }
 
36
 
 
37
        Noise::~Noise()
 
38
        {
 
39
        }
 
40
 
 
41
        void Noise::create()
 
42
        {
 
43
                mCreated = true;
 
44
        }
 
45
 
 
46
        void Noise::remove()
 
47
        {
 
48
                mCreated = false;
 
49
        }
 
50
 
 
51
        bool Noise::createGPUNormalMapResources(GPUNormalMapManager *g)
 
52
        {
 
53
                if (mGPUNormalMapSupported && !mGPUNormalMapResourcesCreated)
 
54
                {
 
55
                        mGPUNormalMapResourcesCreated = true;
 
56
 
 
57
                        g->remove();
 
58
 
 
59
                        return true;
 
60
                }
 
61
 
 
62
                return false;
 
63
        }
 
64
 
 
65
        void Noise::removeGPUNormalMapResources(GPUNormalMapManager *g)
 
66
        {
 
67
                if (mGPUNormalMapSupported && mGPUNormalMapResourcesCreated)
 
68
                {
 
69
                        mGPUNormalMapResourcesCreated = false;
 
70
 
 
71
                        g->remove();
 
72
                }
 
73
        }
 
74
 
 
75
        void Noise::saveCfg(Ogre::String &Data)
 
76
        {
 
77
                Data += "#Noise options\n";
 
78
                Data += "Noise="+mName+"\n\n";
 
79
        }
 
80
 
 
81
        bool Noise::loadCfg(const Ogre::ConfigFile &CfgFile)
 
82
        {
 
83
                if (CfgFile.getSetting("Noise") == mName)
 
84
                {
 
85
                        return true;
 
86
                }
 
87
 
 
88
                return false;
 
89
        }
 
90
}}
 
 
b'\\ No newline at end of file'