00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "SkyBoxComponent.h"
00019 #include "../../core/GameManager.h"
00020
00021
00022
00023
00024 SkyBoxComponent::SkyBoxComponent(Entity *parent, ITexture *top, ITexture *bottom, ITexture *left,
00025 ITexture *right, ITexture *front, ITexture *back)
00026 : SceneComponent(parent, true)
00027 {
00028
00029 ISceneManager *pSceneMgr = GameManager::Instance()->getSceneManager();
00030
00031
00032 mSceneNode = pSceneMgr->addSkyBoxSceneNode(top, bottom, left, right, front, back, 0,
00033 parent->getID());
00034
00035
00036 mTriSelector = NULL;
00037 mMetaSelector = NULL;
00038 }
00039
00040
00041 SkyBoxComponent::SkyBoxComponent(Entity *parent, const std::string &top, const std::string &bottom,
00042 const std::string &left, const std::string &right,
00043 const std::string &front, const std::string &back)
00044 : SceneComponent(parent, true)
00045 {
00046
00047 ISceneManager *pSceneMgr = GameManager::Instance()->getSceneManager();
00048 IVideoDriver *pDriver = GameManager::Instance()->getDriver();
00049
00050
00051 mSceneNode = pSceneMgr->addSkyBoxSceneNode(pDriver->getTexture(top.c_str()),
00052 pDriver->getTexture(bottom.c_str()),
00053 pDriver->getTexture(left.c_str()),
00054 pDriver->getTexture(right.c_str()),
00055 pDriver->getTexture(front.c_str()),
00056 pDriver->getTexture(back.c_str()),
00057 0, parent->getID());
00058
00059
00060 mTriSelector = NULL;
00061 mMetaSelector = NULL;
00062 }
00063
00064
00065 SkyBoxComponent::~SkyBoxComponent()
00066 {
00067 }
00068
00069
00070 SkyBoxComponent* SkyBoxComponent::refFactory(Entity *parent, const std::string &top,
00071 const std::string &bottom, const std::string &left,
00072 const std::string &right, const std::string &front,
00073 const std::string &back)
00074 {
00075 return new SkyBoxComponent(parent, top, bottom, left, right, front, back);
00076 }
00077
00078
00079
00080 void bindSkyBoxComponent(asIScriptEngine *engine)
00081 {
00082
00083 int r;
00084
00085
00086 r = engine->RegisterObjectType("SkyBoxComponent", sizeof(SkyBoxComponent), asOBJ_REF); assert(r >= 0);
00087
00088
00089 bindSceneComponentBase<SkyBoxComponent>(engine, "SkyBoxComponent");
00090
00091
00092 r = engine->RegisterObjectBehaviour("SkyBoxComponent", asBEHAVE_FACTORY, "SkyBoxComponent@ f(Entity @, " \
00093 "const string &, const string &, const string &, const string &, " \
00094 "const string &, const string &)",
00095 asFUNCTIONPR(SkyBoxComponent::refFactory, (Entity*, const std::string&,
00096 const std::string&, const std::string&, const std::string&, const std::string&,
00097 const std::string&), SkyBoxComponent*), asCALL_CDECL); assert(r >= 0);
00098 }
00099