Revision: 2478
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2478&view=rev
Author:   ulteq
Date:     2012-04-11 05:15:44 +0000 (Wed, 11 Apr 2012)
Log Message:
-----------
-Cleanup: reduced dependencies, converted some #defines into proper 
enumerations, removed 'using namespace Ogre;' from materialFunctionMapper.h

Modified Paths:
--------------
    trunk/source/main/audio/Sound.h
    trunk/source/main/audio/SoundScriptManager.cpp
    trunk/source/main/audio/SoundScriptManager.h
    trunk/source/main/gfx/materialFunctionMapper.cpp
    trunk/source/main/gfx/materialFunctionMapper.h
    trunk/source/main/physics/air/turbojet.cpp
    trunk/source/main/physics/air/turbojet.h
    trunk/source/main/utils/MeshObject.h

Modified: trunk/source/main/audio/Sound.h
===================================================================
--- trunk/source/main/audio/Sound.h     2012-04-09 22:14:27 UTC (rev 2477)
+++ trunk/source/main/audio/Sound.h     2012-04-11 05:15:44 UTC (rev 2478)
@@ -25,7 +25,6 @@
 #define __Sound_H_
 
 #include "RoRPrerequisites.h"
-#include "Ogre.h"
 #include <AL/al.h>
 
 

Modified: trunk/source/main/audio/SoundScriptManager.cpp
===================================================================
--- trunk/source/main/audio/SoundScriptManager.cpp      2012-04-09 22:14:27 UTC 
(rev 2477)
+++ trunk/source/main/audio/SoundScriptManager.cpp      2012-04-11 05:15:44 UTC 
(rev 2478)
@@ -17,11 +17,14 @@
 You should have received a copy of the GNU General Public License
 along with Rigs of Rods.  If not, see <http://www.gnu.org/licenses/>.
 */
+
 #ifdef USE_OPENAL
 
+#include "Beam.h"
+#include "Settings.h"
 #include "Sound.h"
+#include "SoundManager.h"
 #include "SoundScriptManager.h"
-#include "Settings.h"
 
 // some gcc fixes
 #if OGRE_PLATFORM == OGRE_PLATFORM_LINUX
@@ -30,17 +33,23 @@
 
 using namespace Ogre;
 
-SoundScriptManager::SoundScriptManager() : soundsDisabled(false)
+const float SoundScriptInstance::PITCHDOWN_FADE_FACTOR   = 3.0f;
+const float SoundScriptInstance::PITCHDOWN_CUTOFF_FACTOR = 5.0f;
+
+SoundScriptManager::SoundScriptManager() :
+         soundsDisabled(false)
+       , loadingBase(false)
+       , instance_counter(0)
+       , maxDistance(500.0)
+       , rolloffFactor(1.0)
+       , referenceDistance(7.5)
 {
-       // TODO: init variables in constr.
-       instance_counter=0;
-       maxDistance=500.0;
-       loadingBase=false;
-       rolloffFactor=1.0;
-       referenceDistance=7.5;
-       for (int i=0; i<SS_MAX_TRIG; i++) free_trigs[i]=0;
-       for (int i=0; i<SS_MAX_MOD; i++)
+       for (int i=0; i < SS_MAX_TRIG; i++)
        {
+               free_trigs[i]=0;
+       }
+       for (int i=0; i < SS_MAX_MOD; i++)
+       {
                free_pitches[i]=0;
                free_gains[i]=0;
        }
@@ -58,7 +67,7 @@
        // reset all states
        statemap.clear();
 
-       sm=new SoundManager(); //we can give a device name if we want here
+       sm = new SoundManager(); // we can give a device name if we want here
        LOG("SoundScriptManager: Sound Manager started with 
"+TOSTRING(sm->getNumHardwareSources())+" sources");
        mScriptPatterns.push_back("*.soundscript");
        ResourceGroupManager::getSingleton()._registerScriptLoader(this);
@@ -396,10 +405,6 @@
        baseTemplate = _baseTemplate;
 }
 
-SoundScriptTemplate::~SoundScriptTemplate()
-{
-}
-
 bool SoundScriptTemplate::setParameter(Ogre::StringVector vec)
 {
 //     for (int i=0; i<vec.size(); i++) LOG("SoundScriptManager: Parsing line 
'"+vec[i]+"'");
@@ -811,5 +816,5 @@
                if(sounds[i]) sounds[i]->setEnabled(e);
        }
 }
-#endif //OPENAL
 
+#endif // USE_OPENAL

Modified: trunk/source/main/audio/SoundScriptManager.h
===================================================================
--- trunk/source/main/audio/SoundScriptManager.h        2012-04-09 22:14:27 UTC 
(rev 2477)
+++ trunk/source/main/audio/SoundScriptManager.h        2012-04-11 05:15:44 UTC 
(rev 2478)
@@ -17,28 +17,23 @@
 You should have received a copy of the GNU General Public License
 along with Rigs of Rods.  If not, see <http://www.gnu.org/licenses/>.
 */
+
 #ifdef USE_OPENAL
 
-#ifndef __SoundScriptManager_H__
-#define __SoundScriptManager_H__
+#ifndef __SoundScriptManager_H_
+#define __SoundScriptManager_H_
 
 #include "RoRPrerequisites.h"
-#include "Ogre.h"
-#include "Beam.h"
+#include "BeamData.h" // for MAX_TRUCKS
 #include "OgreScriptLoader.h"
-#include "OgreResourceGroupManager.h"
-#include "Sound.h"
-#include "SoundManager.h"
 #include "Singleton.h"
 
-// TODO: fix this fugly defines into a proper enum
-#define MAX_SOUNDS_PER_SCRIPT 16
-#define MAX_INSTANCES_PER_GROUP 256
+enum {
+       MAX_SOUNDS_PER_SCRIPT = 16,
+       MAX_INSTANCES_PER_GROUP = 256
+};
 
-#define PITCHDOWN_FADE_FACTOR   3.0
-#define PITCHDOWN_CUTOFF_FACTOR 5.0
-
-//list of sound triggers
+// list of sound triggers
 enum {
        SS_TRIG_NONE = -1,
        SS_TRIG_ENGINE = 0,
@@ -106,7 +101,7 @@
        SS_MAX_TRIG
 };
 
-//list of modulation sources
+// list of modulation sources
 enum {
        SS_MOD_NONE,
        SS_MOD_ENGINE,
@@ -141,7 +136,8 @@
        SS_MAX_MOD
 };
 
-enum {SL_DEFAULT,
+enum {
+       SL_DEFAULT,
        SL_COMMAND, 
        SL_HYDRO, 
        SL_COLLISION, 
@@ -155,61 +151,79 @@
        SL_FLEXBODIES, 
        SL_EXHAUSTS, 
        SL_VIDEOCAMERA, 
-       SL_MAX};
+       SL_MAX
+};
 
+class Sound;
+class SoundManager;
+
 class SoundScriptTemplate
 {
+       friend class SoundScriptManager;
+       friend class SoundScriptInstance;
+
 public:
+
        SoundScriptTemplate(Ogre::String name, Ogre::String groupname, 
Ogre::String filename, bool baseTemplate);
-       bool setParameter(StringVector vec);
-       ~SoundScriptTemplate();
+       
+private:
 
-//protected:
        int parseModulation(Ogre::String str);
+       bool setParameter(Ogre::StringVector vec);
+
        Ogre::String name;
+       Ogre::String filename;
        Ogre::String groupname;
-       Ogre::String filename;
-       int          trigger_source;
-       int          pitch_source;
+
+       bool         baseTemplate;
+       bool         has_start_sound;
+       bool         has_stop_sound;
+       bool         unpitchable;
+
+       float        gain_multiplier;
+       float        gain_offset;
+       float        gain_square;
+       int          gain_source;
+
+       float        pitch_multiplier;
        float        pitch_offset;
-       float        pitch_multiplier;
        float        pitch_square;
-       int          gain_source;
-       float        gain_offset;
-       float        gain_multiplier;
-       float        gain_square;
-       bool         has_start_sound;
+       int          pitch_source;
+
+       Ogre::String sound_names[MAX_SOUNDS_PER_SCRIPT];
+       float        sound_pitches[MAX_SOUNDS_PER_SCRIPT];
+       Ogre::String start_sound_name;
        float        start_sound_pitch;
-       Ogre::String start_sound_name;
-       bool         has_stop_sound;
+       Ogre::String stop_sound_name;
        float        stop_sound_pitch;
-       Ogre::String stop_sound_name;
-       bool         unpitchable;
+
+       int          trigger_source;
        int          free_sound;
-       float        sound_pitches[MAX_SOUNDS_PER_SCRIPT];
-       Ogre::String sound_names[MAX_SOUNDS_PER_SCRIPT];
-       bool         baseTemplate;
 };
 
 class SoundScriptInstance
 {
+       friend class SoundScriptManager;
+
 public:
+
        SoundScriptInstance(int truck, SoundScriptTemplate* templ, 
SoundManager* sm, Ogre::String instancename, int soundLinkType=SL_DEFAULT, int 
soundLinkItemId=-1);
+       void runOnce();
+       void setEnabled(bool e);
+       void setGain(float value);
        void setPitch(float value);
-       void setGain(float value);
        void setPosition(Ogre::Vector3 pos, Ogre::Vector3 velocity);
-       void runOnce();
        void start();
        void stop();
-       
-       int truck;  // holds the number of the truck this is for. important
-       int soundLinkType; // holds the SL_ type this is bound to
-       int soundLinkItemId; // holds the item number this is for
 
-       void setEnabled(bool e);
+       static const float PITCHDOWN_FADE_FACTOR;
+       static const float PITCHDOWN_CUTOFF_FACTOR;
+
+private:
+
+       float pitchgain_cutoff(float sourcepitch, float targetpitch);
+
        SoundScriptTemplate* templ;
-
-protected:
        SoundManager* sm;
        Sound *startSound;
        Sound *stopSound;
@@ -218,27 +232,27 @@
        float stopSound_pitchgain;
        float sounds_pitchgain[MAX_SOUNDS_PER_SCRIPT];
        float lastgain;
-       float pitchgain_cutoff(float sourcepitch, float targetpitch);
+
+       int truck;                              // holds the number of the 
truck this is for. important
+       int soundLinkType;              // holds the SL_ type this is bound to
+       int soundLinkItemId;    // holds the item number this is for
 };
 
-class SoundScriptManager : public ScriptLoader , public 
RoRSingleton<SoundScriptManager>
+class SoundScriptManager : public Ogre::ScriptLoader, public 
RoRSingleton<SoundScriptManager>
 {
 public:
-       const static int TERRAINSOUND = MAX_TRUCKS+1;
 
        SoundScriptManager();
 
        // ScriptLoader interface
-    const StringVector& getScriptPatterns(void) const;
-    void parseScript(DataStreamPtr& stream, const Ogre::String& groupName);
-    Real getLoadingOrder(void) const;
+    const Ogre::StringVector& getScriptPatterns(void) const;
+    void parseScript(Ogre::DataStreamPtr& stream, const Ogre::String& 
groupName);
+    Ogre::Real getLoadingOrder(void) const;
 
-       SoundScriptInstance* createInstance(Ogre::String templatename, int 
truck, SceneNode *toAttach=NULL, int soundLinkType=SL_DEFAULT, int 
soundLinkItemId=-1);
+       SoundScriptInstance* createInstance(Ogre::String templatename, int 
truck, Ogre::SceneNode *toAttach=NULL, int soundLinkType=SL_DEFAULT, int 
soundLinkItemId=-1);
        void unloadResourceGroup(Ogre::String groupname);
        void clearNonBaseTemplates();
 
-
-
        // functions
        void trigOnce    (int truck, int trig, int linkType = SL_DEFAULT, int 
linkItemID=-1);
        void trigOnce    (Beam *b,   int trig, int linkType = SL_DEFAULT, int 
linkItemID=-1);
@@ -260,22 +274,25 @@
 
        inline bool working() { return !soundsDisabled; }
 
+       static const unsigned int TERRAINSOUND = MAX_TRUCKS+1;
+
+private:
+
+       SoundScriptTemplate* createTemplate(Ogre::String name, Ogre::String 
groupname, Ogre::String filename);
+       void skipToNextCloseBrace(Ogre::DataStreamPtr& chunk);
+       void skipToNextOpenBrace(Ogre::DataStreamPtr& chunk);
+
+    Ogre::StringVector mScriptPatterns;
+       int instance_counter;
+       bool loadingBase;
+       bool soundsDisabled;
        float maxDistance;
        float rolloffFactor;
        float referenceDistance;
-protected:
-    StringVector mScriptPatterns;
-       int instance_counter;
-       bool loadingBase;
-       bool soundsDisabled;
 
        std::map <Ogre::String, SoundScriptTemplate*> templates;
 
-       void skipToNextCloseBrace(DataStreamPtr& chunk);
-       void skipToNextOpenBrace(DataStreamPtr& chunk);
-       SoundScriptTemplate* createTemplate(Ogre::String name, Ogre::String 
groupname, Ogre::String filename);
-
-       //instances lookup tables
+       // instances lookup tables
        int free_trigs[SS_MAX_TRIG];
        SoundScriptInstance *trigs[SS_MAX_TRIG * MAX_INSTANCES_PER_GROUP];
 
@@ -285,15 +302,13 @@
        int free_gains[SS_MAX_MOD];
        SoundScriptInstance *gains[SS_MAX_MOD * MAX_INSTANCES_PER_GROUP];
 
-       //state map
-       // TODO: replace with STL container to save memory
+       // state map
        // soundLinks, soundItems, trucks, triggers
        std::map <int, std::map <int, std::map <int, std::map <int, bool > > > 
> statemap;
 
        SoundManager* sm;
 };
 
-#endif // __SoundScriptManager_H__
+#endif // __SoundScriptManager_H_
 
 #endif // USE_OPENAL
-

Modified: trunk/source/main/gfx/materialFunctionMapper.cpp
===================================================================
--- trunk/source/main/gfx/materialFunctionMapper.cpp    2012-04-09 22:14:27 UTC 
(rev 2477)
+++ trunk/source/main/gfx/materialFunctionMapper.cpp    2012-04-11 05:15:44 UTC 
(rev 2478)
@@ -17,17 +17,12 @@
 You should have received a copy of the GNU General Public License
 along with Rigs of Rods.  If not, see <http://www.gnu.org/licenses/>.
 */
+
 #include "materialFunctionMapper.h"
 #include "Settings.h"
 
-MaterialFunctionMapper::MaterialFunctionMapper()
-{
-}
+using namespace Ogre;
 
-MaterialFunctionMapper::~MaterialFunctionMapper()
-{
-}
-
 void MaterialFunctionMapper::addMaterial(int flareid, materialmapping_t t)
 {
        MaterialPtr m = 
Ogre::MaterialManager::getSingleton().getByName(t.material);

Modified: trunk/source/main/gfx/materialFunctionMapper.h
===================================================================
--- trunk/source/main/gfx/materialFunctionMapper.h      2012-04-09 22:14:27 UTC 
(rev 2477)
+++ trunk/source/main/gfx/materialFunctionMapper.h      2012-04-11 05:15:44 UTC 
(rev 2478)
@@ -18,38 +18,34 @@
 along with Rigs of Rods.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef MATERIALTRUCKMAPPING_H_
-#define MATERIALTRUCKMAPPING_H_
+#ifndef __MATERIALTRUCKMAPPING_H_
+#define __MATERIALTRUCKMAPPING_H_
 
 #include "RoRPrerequisites.h"
 
-#include "Ogre.h"
-using namespace Ogre;
-
-
 typedef struct
 {
-       int type;
-       Ogre::String originalmaterial;
-       Ogre::String material;
        Ogre::ColourValue emissiveColour;
+       Ogre::String material;
+       Ogre::String originalmaterial;
        bool laststate;
+       int type;
 } materialmapping_t;
 
 class MaterialFunctionMapper
 {
 public:
-       MaterialFunctionMapper();
-       ~MaterialFunctionMapper();
+
        void addMaterial(int flareid, materialmapping_t t);
        void toggleFunction(int flareid, bool enabled);
-       // this function searchs and replaces materials in meshes
+       // this function searches and replaces materials in meshes
        void replaceMeshMaterials(Ogre::Entity *e);
        static void replaceSimpleMeshMaterials(Ogre::Entity *e, 
Ogre::ColourValue c = Ogre::ColourValue::White);
 
-protected:
+private:
+
        static int simpleMaterialCounter;
        std::map <int, std::vector<materialmapping_t> > materialBindings;
 };
 
-#endif
+#endif // __MATERIALTRUCKMAPPING_H_

Modified: trunk/source/main/physics/air/turbojet.cpp
===================================================================
--- trunk/source/main/physics/air/turbojet.cpp  2012-04-09 22:14:27 UTC (rev 
2477)
+++ trunk/source/main/physics/air/turbojet.cpp  2012-04-11 05:15:44 UTC (rev 
2478)
@@ -17,12 +17,16 @@
 You should have received a copy of the GNU General Public License
 along with Rigs of Rods.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+#include "materialFunctionMapper.h"
+#include "MaterialReplacer.h"
+#include "Ogre.h"
 #include "skin.h"
 #include "SoundScriptManager.h"
 #include "turbojet.h"
-#include "materialFunctionMapper.h"
-#include "MaterialReplacer.h"
 
+using namespace Ogre;
+
 Turbojet::Turbojet(SceneManager *manager, char* propname, int tnumber, int 
trucknum, node_t *nd, int tnodefront, int tnodeback, int tnoderef, float 
tmaxdrythrust, bool treversable, bool tafterburnable, float tafterburnthrust, 
float diskdiam, float nozdiam, float nozlength, bool disable_smoke, bool 
_heathaze, MaterialFunctionMapper *mfm, Skin *usedSkin, MaterialReplacer *mr) : 
mr(mr)
 {
        heathaze=_heathaze;

Modified: trunk/source/main/physics/air/turbojet.h
===================================================================
--- trunk/source/main/physics/air/turbojet.h    2012-04-09 22:14:27 UTC (rev 
2477)
+++ trunk/source/main/physics/air/turbojet.h    2012-04-11 05:15:44 UTC (rev 
2478)
@@ -21,81 +21,77 @@
 #define __Turbojet_H_
 
 #include "RoRPrerequisites.h"
-
 #include "aeroengine.h"
 
 class Turbojet: public AeroEngine
 {
+public:
+
+       Turbojet(Ogre::SceneManager *manager, char* propname, int tnumber, int 
trucknum, node_t *nd, int tnodefront, int tnodeback, int tnoderef, float 
tmaxdrythrust, bool treversable, bool tafterburnable, float tafterburnthrust, 
float diskdiam, float nozdiam, float nozlength, bool disable_smoke, bool 
heathaze, MaterialFunctionMapper *mfm, Skin *usedSkin, MaterialReplacer *mr);
+
+       void flipStart();
+       void reset();
+       void setRPM(float _rpm);
+       void setThrottle(float val);
+       void toggleReverse();
+       void updateForces(float dt, int doUpdate);
+       void updateVisuals();
+
+       Ogre::Vector3 getAxis() {return axis;};
+
+       bool getIgnition() {return ignition;};
+       bool getWarmup() {return warmup;};
+       bool isFailed() {return failed;};
+       float getAfterburner() {return (float)afterburner;};
+       float getRPM() { return rpm; };
+       float getRPMpc() { return rpm; };
+       float getRadius() {return radius;};
+       float getThrottle();
+       float getpropwash() {return propwash;};
+       int getNoderef() {return nodeback;};
+       int getType() {return AEROENGINE_TYPE_TURBOJET;};
+
+       bool afterburnable;
+
 private:
+
        MaterialReplacer *mr;
-       node_t *nodes;
-       int number;
-       bool reverse;
+       Ogre::ParticleSystem* heathazePS;
+       Ogre::ParticleSystem* smokePS;
+       Ogre::SceneNode *absnode;
+       Ogre::SceneNode *nzsnode;
+       Ogre::Vector3 axis;
+       bool afterburner;
+       bool failed;
+       bool heathaze;
        bool ignition;
+       bool reversable;
+       bool reverse;
+       bool warmup;
+       float afterburnthrust; //in kN
+       float area;
+       float exhaust_velocity; //in m/s
+       float lastflip;
+       float maxdrythrust; //in kN
+       float propwash;
        float radius;
-       bool failed;
+       float reflen;
        float rpm; //in percent!
        float throtle;
+       float timer;
        float warmupstart;
        float warmuptime;
-       bool warmup;
-       int nodefront;
+       int ab_id;
+       int mod_id;
        int nodeback;
+       int nodefront;
        int noderef;
-       float propwash;
-       Vector3 axis;
-       float reflen;
-       float timer;
-       float lastflip;
-       bool reversable;
-       bool afterburner;
-       float maxdrythrust; //in kN
-       float afterburnthrust; //in kN
-       float exhaust_velocity; //in m/s
-       float area;
-       ParticleSystem* smokePS;
-       ParticleSystem* heathazePS;
-    SceneNode *smokeNode;
-
-       SceneNode *nzsnode;
-       SceneNode *absnode;
-       bool heathaze;
-       int trucknum;
-       int mod_id;
+       int number;
        int src_id;
        int thr_id;
-       int ab_id;
-
-public:
-       bool afterburnable;
-
-       Turbojet(SceneManager *manager, char* propname, int tnumber, int 
trucknum, node_t *nd, int tnodefront, int tnodeback, int tnoderef, float 
tmaxdrythrust, bool treversable, bool tafterburnable, float tafterburnthrust, 
float diskdiam, float nozdiam, float nozlength, bool disable_smoke, bool 
heathaze, MaterialFunctionMapper *mfm, Skin *usedSkin, MaterialReplacer *mr);
-
-       void updateVisuals();
-       void updateForces(float dt, int doUpdate);
-
-       void setThrottle(float val);
-
-       float getThrottle();
-
-       void reset();
-
-       void toggleReverse();
-
-       void flipStart();
-
-       float getRPM() { return rpm; };
-       float getRPMpc() { return rpm; };
-       void setRPM(float _rpm);
-       float getpropwash() {return propwash;};
-       Vector3 getAxis() {return axis;};
-       bool isFailed() {return failed;};
-       int getType() {return AEROENGINE_TYPE_TURBOJET;};
-       bool getIgnition() {return ignition;};
-       int getNoderef() {return nodeback;};
-       bool getWarmup() {return warmup;};
-       float getRadius() {return radius;};
-       float getAfterburner() {return (float)afterburner;};
+       int trucknum;
+       node_t *nodes;
+       Ogre::SceneNode *smokeNode;
 };
 
 #endif // __Turbojet_H_

Modified: trunk/source/main/utils/MeshObject.h
===================================================================
--- trunk/source/main/utils/MeshObject.h        2012-04-09 22:14:27 UTC (rev 
2477)
+++ trunk/source/main/utils/MeshObject.h        2012-04-11 05:15:44 UTC (rev 
2478)
@@ -24,15 +24,13 @@
 #define MESHOBJECT_H__
 
 #include "RoRPrerequisites.h"
-
 #include "Ogre.h"
 
 #include "materialFunctionMapper.h"
-#include "skin.h"
 #include "MaterialReplacer.h"
 #include "Settings.h"
+#include "skin.h"
 
-
 class MeshObject : public Ogre::ResourceBackgroundQueue::Listener, public 
Ogre::Resource::Listener
 {
 public:
@@ -72,12 +70,12 @@
        void postProcess();
        void loadMesh();
 
-       void operationCompleted(BackgroundProcessTicket ticket, const 
BackgroundProcessResult& result);
-       void backgroundLoadingComplete(Resource *r);
-       void backgroundPreparingComplete(Resource *r);
-       void loadingComplete(Resource *r);
-       void preparingComplete(Resource *r);
-       void unloadingComplete(Resource *r);
+       void operationCompleted(Ogre::BackgroundProcessTicket ticket, const 
Ogre::BackgroundProcessResult& result);
+       void backgroundLoadingComplete(Ogre::Resource *r);
+       void backgroundPreparingComplete(Ogre::Resource *r);
+       void loadingComplete(Ogre::Resource *r);
+       void preparingComplete(Ogre::Resource *r);
+       void unloadingComplete(Ogre::Resource *r);
 };
 
 #endif //MESHOBJECT_H__

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Rigsofrods-devel mailing list
Rigsofrods-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel

Reply via email to